Kann Avatar-Flair nicht mehr durch Festlegen der primären Gruppe zuweisen

I would like to give all users in a group an avatar flair.

I used to be able to set the flair in the group settings, check the “Automatically set as primary group” option, and everyone in the group would automatically get the flair added to their avatar.

Now, however, it seems that a user’s flair is not associated with their primary group. I can verify that a user’s primary group is correctly set, but their avatar still does not display the flair.

While poking around, I noticed a new setting on the user preferences page that allows users to select their own flair.


I’m guessing that the addition of this preference setting broke the association between a user’s primary group and their avatar flair.

Question: Is there any way now to bulk assign the flair for every user in a group? I don’t want to message the group and instruct them all on how to set this in their preferences, and I don’t want to go through one by one and update each user’s preferences for them.

3 „Gefällt mir“

This forces group members to have the group avatar:

rails c
 target_group = Group.find_by_name("=GroupSlug=")
 users = User.joins(:group_users).where(group_users:{group_id: target_group.id})
 users.each do |u|
  u.flair_group_id = target_group.id
  u.save
 end
Exit
4 „Gefällt mir“

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

I added a fix for this issue in the above PR.

2 „Gefällt mir“

Ich habe das gerade noch einmal versucht.

Mir ist aufgefallen, dass Änderungen an der Einstellung der primären Gruppe den Flair des Benutzers nicht auf den Gruppen-Flair zu aktualisieren schienen. Funktioniert die obige Korrektur noch?

Positiv anzumerken ist, dass ich meinen kleinen Rails-Konsolen-Code-Schnipsel oben verbessert habe, sodass Sie nur den Gruppenschnecken (und bestätigt, dass er immer noch funktioniert!) benötigen.