Problem/Motivation

In an install with Views not installed (i.e. minimal install), the 'Last access' column in the default People list shows the years since UNIX timestamp 0 for newly created users (or anybody that has never logged in).

Steps to reproduce:

  • Do minimal install
  • Create a new user
  • Go to admin/people

Proposed resolution

Show 'never' like in the corresponding View.

Remaining tasks

User interface changes

Show something proper.

Before

After


Comments

Lendude created an issue. See original summary.

lendude’s picture

Issue tags: +D8UX usability, +Needs tests
StatusFileSize
new837 bytes

This patch should fix it, but doesn't, because currently user.access and user.login default to 0 and not NULL. And since unix timestamp 0 is a perfectly valid non-empty timestamp, it's (rightly) not considered empty.

Will open a new issue to discuss the default values that need to be set to NULL.

lendude’s picture

lendude’s picture

Status: Active » Needs review
lendude’s picture

Failing test and fix.

Still feel the fix in #2 is the way to go, but don't know if setting access to NULL has any other implications and how likely that is to actually make it in. The Views version of the people list deals with the 0 value, so just making the non-views version deal with it also makes sense.

The last submitted patch, 5: users_show_never-2609504-5-TEST_ONLY.patch, failed testing.

lendude’s picture

Issue summary: View changes
StatusFileSize
new27.42 KB
lendude’s picture

Issue summary: View changes
ibustos’s picture

I confirm the issue still exists when using the default date formatter. Attached an evidence.

mohit_aghera’s picture

Issue summary: View changes
Status: Needs review » Needs work
StatusFileSize
new34.34 KB

@ibustos
It's failing after applying patch. I've tested it with latest D8 head
see attached file.

Patched in comment #5 is working fine.

mohit_aghera’s picture

StatusFileSize
new33.62 KB

Testing patch #5
It seems appearing fine with latest D8 head

lendude’s picture

@ibustos and @mohit_aghera thanks for looking at this!

About #9, as I pointed out in #1 and #2, 0 is a perfectly valid timestamp so making the default formatter interpret that as 'never' seems wrong to me (since it's Jan 1ste 1970). The patch in #5 is more of a work around to get the non-Views People display in line with the Views version.

I still think that actual fix for this should be what is outlined in #2, but that also feel a little like overkill for this issue, and not something that can be put into 8.0.x

lendude’s picture

Status: Needs work » Needs review

putting this back on need review for #5

mohit_aghera’s picture

Status: Needs review » Reviewed & tested by the community

@Lendude
Thanks for your input.
As per patch in comment #5 things are appearing fine.
See this comment https://www.drupal.org/node/2609504#comment-10837674
Hence, moving this into RTBC.

catch’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/user/src/UserListBuilder.php
@@ -152,7 +152,7 @@ public function buildRow(EntityInterface $entity) {
+    $row['access'] = $entity->access->getValue()[0]['value'] ? $this->t('@time ago', array('@time' => $this->dateFormatter->formatTimeDiffSince($entity->getLastAccessedTime()))) : t('never');

This looks odd to me. Why not getLastAccessedTime()

mohit_aghera’s picture

Status: Needs work » Needs review
StatusFileSize
new1.86 KB
new864 bytes
new33.76 KB

Thanks @Catch for pointing out the issue.
Adding updated patch with changes mentioned by you.
Uploaded relevant screenshot as well.

catch’s picture

Status: Needs review » Reviewed & tested by the community

RTBC again assuming it comes back green.

catch’s picture

Version: 8.0.x-dev » 8.1.x-dev
Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

This needs a re-roll for 8.1.x

lendude’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new1.79 KB

Reroll for 8.1.x

Handled a little differently in 8.1, but still bugged.

mohit_aghera’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new32.2 KB

Tested #19 locally by applying patch.
Working fine. Screenshot attached.

  • catch committed 68e9f22 on 8.1.x
    Issue #2609504 by Lendude, mohit_aghera, ibustos: Default People display...

  • catch committed 095431b on 8.0.x
    Issue #2609504 by Lendude, mohit_aghera, ibustos: Default People display...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.1.x and 8.0.x thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.