User Card Directory

Dear David, i find a problem

when I select a group, scrolling the mouse to load more, all users will be loaded directly instead of selected group members.

can you have a look on this

3 Likes

Thank you for another great component :heart_eyes:

There is a small glitch with the new Dark Mode setting:

Dark Theme:

Light Theme with automatic Dark Mode colour scheme enabled:

And a request: is it possible to add two settings to this component for

  • selecting default timespan
  • selecting default type and order to sort by

I’d like to display users who were the most active readers in the past year at the top by setting default timespan to ‘Year’ and sort descending by ‘Read’.

Is this something that can be easily added?

3 Likes

Hi @david This theme component continues to add value to our Discourse, but recently a known bug/feature caused some really confusion and pain for us.

The known bug/feature: The logged in user is always returned in the results even if they don’t match the filter condition.

In the case below, my user isn’t part of the ruby group, but I show up.

What’s possible in terms of changing the theme—so that the user viewing the directory, doesn’t see themselves in results where they don’t belong?

Thanks so much for digging into what we could do to help change this behavior. We’re on Discourse-based hosting.

3 Likes

Good catch, @alxpck. I can reproduce on 2.6.0.beta5.

2 Likes

Thoughts @david or @tobiaseigen on what’s possible here?

2 Likes

Hi @alxpck, sorry for the delayed response here!

This is actually coming from the core ‘user directory’ behaviour - you can see it if you open /u here on Meta and try filtering by username. The current user will always be shown in the list, regardless of what you filter by. For example

But you’re right that it becomes super confusing when filtering by groups. If someone is deliberately filtering like that, they probably don’t want to see themselves (unless they match the filter).

I opened a PR in core here for discussion: https://github.com/discourse/discourse/pull/11310

Let’s see how that goes - if we decide not to make that change in core, we can look at a workaround for this theme component.

7 Likes

Thank you so much @david. I really appreciate you looking at this from both a core Discourse and a User Card Directory theme perspective.

Either way you come at it, we know making a change would be immensely valuable to our community.

No worries about the delay—2020 am I right?

4 Likes

Yes, especially so if it’s a subscriber group as used by the Subscriptions plugin.

3 Likes

I merged @david’s change… your sites will get it over the next week or so.

The only open item is deciding on fidelity of “always show me” if I visit the directory and am not filtering anything.

Are you still interested in the “don’t every show myself first when I visit the /u page (even without a filter)” feature, we could sort of work around it in the component.

6 Likes

Wonderful! Thank you @sam @david and team!

Re: “always show me”

  • I can see how it makes sense to always show the user their own profile prominently with the default /u page layout which is a kind of stats-driven leaderboard. That way it’s easy for them to measure themselves against the other people on the Discourse.
  • For our uses, with the User Card Directory, the page isn’t about comparison but discovery. People don’t need to discover their own profile so having one of the top slots always filled with their own info isn’t helpful or the best use of real estate. If they do want to find their own profile we’ve trained them to visit /my/summary or click on their photo.

I can’t speak to all the other use cases for other people’s Discourses, but for our needs we’d definitely prefer if it was possible to avoid showing people their own profile (with or without a filter).

4 Likes

I can’t speak for others and have not heard much complaining about the user directory, but personally I also do not use it as a leaderboard and like it mostly for discovery.

Maybe a toggle could be provided to make it go away?

3 Likes

Possibly, we need a call fro @codinghorror if he wants site setting in core of if this is a theme component thing, it has popped up 2-3 times over the years

At a minimum we can adjust core in such a way that a theme component can amend this

5 Likes

I am not sure, the “grid of cards” thing seems rather site specific. I think it is fine for it to be a site setting? I don’t have strong feelings about this, but I don’t think it makes sense as a default.

4 Likes

Here’s a PR which adds a ‘hide current user’ setting to the theme component. If enabled, it will always hide the current user from view

https://github.com/discourse/discourse-user-card-directory/pull/1

4 Likes

Does it handle the case where you actually want to see current user? eg you searched for yourself… you are at the top of the leaderboard … etc?

Probably good enough as is for @alxpck … but thinking out loud.

3 Likes

It unconditionally hides the current user, and it’s a default-disabled theme setting. I think that’s acceptable for the user-card layout? But definitely wouldn’t work for a leaderboard.

3 Likes

Thank you!

This is a wonderful improvement.

We would prefer the granularity that @sam mentioned (cases where you actually want to see the current user), but removing people from searches where they don’t meet the filter criteria was the problem that brought us here—so I really appreciate the theme setting to hide the current user.

3 Likes

I’m seeing at least a few of my users’ cards appearing more than once… eg “andy1” and “blane” among others on this page:

update: Something funny is going on. I saw it in cognito on Chrome, but I don’t see the dupes logged in when using Safari. This is going to be hard to track down…

3 Likes

Hi Craig - thanks for the report. Looks like this is a problem with Discourse core - it happens even with the user cards component disabled.

The root of the problem is that all your users currently have ‘0’ values for the metrics, and our sorting was inconsistent. I’ve opened a PR to fix the issue, and will get it deployed to your site once it’s merged. Technical details are in the PR if you’re interested

https://github.com/discourse/discourse/pull/11370

5 Likes

That’s fixed, and I’ve deployed the core change to your site @craigconstantine. Let us know if you’re still seeing any issues.

That’s fixed, sorry for the long wait! Update the theme component in your admin dashboard and things should look good on light/dark themes

6 Likes