Commit 68e9f226 authored by catch's avatar catch

Issue #2609504 by Lendude, mohit_aghera, ibustos: Default People display shows...

Issue #2609504 by Lendude, mohit_aghera, ibustos: Default People display shows date since unix timestamp 0 as 'Last access'
parent 2a1c93a2
......@@ -80,6 +80,7 @@ public function testUserListing() {
'status' => (string) $account->td[1],
'roles' => $roles,
'member_for' => (string) $account->td[3],
'last_access' => (string) $account->td[4],
);
}
......@@ -92,6 +93,8 @@ public function testUserListing() {
$this->assertEqual($result_accounts[$role_account_name]['roles'], $expected_roles, 'Ensure roles are listed properly.');
$this->assertEqual($result_accounts[$timestamp_user]['member_for'], \Drupal::service('date.formatter')->formatTimeDiffSince($accounts[$timestamp_user]->created->value), 'Ensure the right member time is displayed.');
$this->assertEqual($result_accounts[$timestamp_user]['last_access'], 'never', 'Ensure the last access time is "never".');
}
}
......@@ -158,7 +158,7 @@ public function buildRow(EntityInterface $entity) {
$row['member_for']['data'] = $this->dateFormatter->formatTimeDiffSince($entity->getCreatedTime(), $options)->toRenderable();
$last_access = $this->dateFormatter->formatTimeDiffSince($entity->getLastAccessedTime(), $options);
if ($entity->access) {
if ($entity->getLastAccessedTime()) {
$row['access']['data']['#markup'] = $last_access->getString();
CacheableMetadata::createFromObject($last_access)->applyTo($row['access']['data']);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment