Cheers in Usercard doesn't "respect" the group visibility settings

AI-generated summary

The issue concerns the ‘Cheers’ feature in user cards and profiles not respecting group visibility settings for leaderboards. jrgong reports that when a leaderboard is restricted to a specific group, users outside that group can still see the Cheers in the user card and profile, with a link to an invalid page. A workaround using CSS is suggested to hide the Cheers for non-allowed users. j.jaffeux adds that the behavior is awkward because gamification defaults to the first leaderboard, so the issue only occurs if a restricted leaderboard is not the first one.

Steps to reproduce:

  1. Limit a leaderboard to a specific group
  2. Log in as said user of a group
  3. The “Cheers” in the user card and user profile are being displayed and the Leaderboard link leads to an invalid page

Expected behavior would be to not display the Cheers in the User card or user profile to users who are not added to the leaderboard “visible to groups” setting

tested on Discourse 3.5.0.beta8-dev

1 Like

As a quick and dirty workaround, I used the following CSS below. You could even wrap around specific “body not staff” CSS to only apply it to regular and anon users so that the Cheers are still visible to admins and mods.

//Cheers score hidden in user card
.user-card-metadata-outlet.gamification-score {
    display: none;
}
//Cheers score hidden in user profile (if it's actually the last <div> inside that <dl> tag and no other plugin or tc adds it's own div after that)
body.user-summary-page #collapsed-info-panel > dl> div:last-child {
    display:none;
}

Yes it’s a little bit awkward because gamfication will declare the first leaderboard as the default, if you had a second leaderboard with the restricted visibility, you wouldn’t have this issue.