Moderators don't have access to Staff category

AI-generated summary

A discussion about moderators not having access to the Staff category in Discourse. bokos initially noticed the issue with their moderators and suspected it was due to their Discourse installation being in German, causing the Staff group to be named “Team”. They attempted a fix in the console, but codinghorror pointed out that permissions are not set based on the text name of the category.

Further investigation by david revealed that the issue is due to localized group names being used in some areas, while unlocalized names are used in others. codinghorror expressed surprise that this issue has not been reported more frequently, especially for non-English Discourse instances.

Other users, including zoul and ErlendMS, have reported similar issues with their non-English Discourse installations, with ErlendMS experiencing the issue in Norwegian and finding a temporary workaround by granting moderator access to a test user.

I noticed my moderators don’t have access to the Staff category. I just installed a fresh discourse locally to test it and it still happens.

I think it’s because my Discourse got installed in German and my Staff group is actually called Team.
So I ran this in console:

staff = Category.find_by(id: SiteSetting.staff_category_id)
staff.group_names = [Group[:staff].name]
staff.save

I hope this doesn’t break anything?

Hmm, no, permissions aren’t set based on the text name of the category.

I just noticed I have the same issue with the Lounge category.
I think the group_names=(names) method of the Category model should find the correct name of the group? Or change the fixtures?

Yes, it looks like we localise the group names here:

But then set category permissions using the unlocalised group name here:

I think this could do with some improvement

Oh dear, I didn’t realize we were using the string names rather than the numeric codes. I wonder why we haven’t seen more complaints about this for Discourse instances in other languages?

I’ve seen the same (or similar?) bug running Discourse in Czech and thought it was a random glitch related just to a single user. It went away after I temporarily turned the moderator into an admin and back IIRC, so I did not bother reporting it.

I think I have the same issue here..?

I have a Norwegian install - and when I’m logged into my admin account, I can’t access the staff category. I see it in “All categories”, but when I click it it just keeps loading.

I made a test user and made it moderator - then that user got access.