Users reported that group flair persists on user avatars even after being removed from the group or changing primary groups, especially when updates occur via Discourse Connect SSO. southpaw initially raised the issue, noting the flair didn’t disappear despite no primary group or flair selection. sam confirmed this was a bug, except for anonymous users with a 1-minute cache edge case. md-misko added that flair also lingers when primary groups are changed manually. A fix was merged in PR #13930, but it doesn’t apply retroactively. kinetiksoft reported the bug persisted in 2.8.0.beta4 and affected many users via SSO. vinothkannans provided a one-time Rails console command to clean up affected users: User.joins(...).where(...).update_all(flair_group_id: nil), which kinetiksoft successfully ran, fixing 370 users. Another fix was later pushed in PR #14367 to prevent recurrence. Users are advised to upgrade and run the cleanup script once, not regularly. No manual flair editing is available in the admin panel, and changing group flair images doesn’t remove outdated flairs from users.
Most jobs are shown in forum.example.com/sidekiq/scheduler. For example if you changed a badge query, you could wait a day for the BadgeGrant job to run, or you could hurry it along by hitting the Trigger button manually. I don’t know which of those jobs updates the flairs though.
We haven’t updated yet to the latest commit as there are no changes present to fix this bug.
In our case, user flairs remain unchanged when we update groups via Discourse Connect SSO. We see the user is no present in the group, but flair remains.
Wow. Well I don’t know the estimates. Based on our data flows, there may be dozens & hundreds of users leaving/joining specific groups via SSO each day.
Anyway I can count users with outdated (unlinked to groups) flairs?
And how does one even edit other users flairs? I couldn’t find such option in admin panel. Not saying that I’m gonna update so many users one by one to remove this bug’s legacy.
By the way, removing flair from group settings and uploading another flair image doesn’t help. Users out of this group still keep the group flair
Just checking if someone knows what to do with this problem
Sorry to bump this post so many times, but this bug is really messing up with our community @vinothkannans do you have any suggestions on how to proceed with it’s effects for us?
Thank you for replying.
Do I understand correctly, that due to the effects of this bug, we should perform queries like these on daily or other frequency basis? The thing is that our users group are being updated daily + every time the user’s subscription status changes on the main website. Everything done via SSO.
Thanks, I will patiently wait for your investigation results before turning to rails queries.
Please let me know if I may be any help to you on this issue
@kinetiksoft below rails code should fix the issue for all the members in every group. It will remove the group flair from users if they don’t belong to that flair group anymore.
Note, you don’t need to run this script regularly. It is a one-time fix for those old affected users. Take a backup as a precaution before running it.
User.joins("LEFT OUTER JOIN group_users ON group_users.user_id = users.id AND group_users.group_id = users.flair_group_id").where(group_users: { id: nil }).where.not(flair_group_id: nil).update_all(flair_group_id: nil)
Thank you! I will let you know once we run the query & will give some updates within upcoming days to see if there is no inconsistency with flairs to groups relations after that
Great, sure, will take a look into upcoming commits in upgrade section.
Should we wait with SQL query from above or we can proceed with it without waiting for commit to be merged in our discourse instance?