User Card Directory

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

How would I go about changing the default sort to “visits” rather than “likes received”?

Thanks!

1 Like

hi! this component is great! We found though a weird behavior while showing the number of followers

image

You can check yourself here: LibreCV

1 Like

I’m afraid that’s not possible at the moment

“Followers” isn’t a concept that exists in Discourse core, so I guess you must be using Follow Plugin 👨. This is something that will need to be fixed in that plugin.

4 Likes

Indeed, I use that plugin - would be great that can be fixed :slight_smile:

1 Like

I could be wrong but believe the repetition of this card breaks its own Plugin Outlets, rendering them useless, but worse, they act unpredictably (or predictably bad?) if you have a dependent Theme Component or Plugin installed. I think it is essentially spamming the template with multiple, identically named plugin outlets?

Can we find a way around that?

1 Like

I don’t think multiple copies of the same plugin outlet should necessarily be an issue. For example, there are plugin outlets on every single row of a topic list, and things work fine there.

What error/issue are you seeing?

3 Likes

That’s encouraging.

So a different model is being passed to each instance?

Currently the same data seems to be repeated on each card

2 Likes

Yeah the user object should be different for each one… in theory

https://github.com/discourse/discourse/blob/65647000a13c2370036db9061f700b3daee7913f/app/assets/javascripts/discourse/app/templates/components/user-card-contents.hbs#L33-L33

Which specific outlet are you using?

1 Like

Yeah, I’m not yet convinced that’s actually happening, but would be delighted if I were wrong.

On Directory:

On solitary card clicked up from Topic list:

image

Perhaps I’m missing a best practice here, not sure.

https://github.com/paviliondev/discourse-follow/blob/679e0ed098ce2b1d8cb0e3e0cbf43383d782be16/assets/javascripts/discourse/connectors/user-card-metadata/follow-statistics-user-card.hbs#L1

2 Likes

I suspect it’s being caused by this:

https://github.com/paviliondev/discourse-follow/blob/master/assets/javascripts/discourse/components/follow-statistic.js.es6#L11-L16

I’m not entirely sure what this code is trying to achieve… but it looks like it’s looking up .card-content .metadata, and then appending itself? to every matching element :thinking:

If you use a standard ember computed property, I think things will work much better.

6 Likes

Aha! That’s a very helpful line of enquiry, thank you. I’ll take a look at refactoring that.

5 Likes

User Card Directory seems to have lost the ability to filter by username. When the component is enabled, typing in the search field has no effect.

When the component is disabled, filtering works as expected.

5 Likes

I am able to replicate this issue. Filtering by group works, but filtering by username has no effect.

3 Likes

This is done, Follow Plugin 👨 should now work with this TC.

4 Likes

Hey. The user cards are beautiful. Thanks for making this.
Can we add an option that hides the user statistics?

1 Like

I’m seeing—I’m guessing here—something wrong with string translations?

https://forum.moversmindset.com/u

2 Likes

Thanks @craigconstantine, we have a fix in the pipeline. I’ll let you know once it’s merged and ready for you to update.

5 Likes