Moderators don't have access to Staff category

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?

إعجابَين (2)

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?

إعجاب واحد (1)

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

https://github.com/discourse/discourse/blob/cbb8f6f0fea62ae25f0d9e4c811e1b97b1f38593/app/models/group.rb#L273

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

https://github.com/discourse/discourse/blob/cbb8f6f0fea62ae25f0d9e4c811e1b97b1f38593/db/fixtures/502_staff_category.rb#L8

I think this could do with some improvement

8 إعجابات

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?

4 إعجابات

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.

3 إعجابات

أعتقد أن لدي نفس المشكلة هنا..؟

لدي تثبيت نرويجي - وعندما أكون مسجلاً الدخول إلى حساب المسؤول الخاص بي، لا يمكنني الوصول إلى فئة الموظفين. أراها في “جميع الفئات”، ولكن عندما أنقر عليها تستمر في التحميل.

لقد أنشأت مستخدمًا تجريبيًا وجعلته مشرفًا - ثم حصل هذا المستخدم على حق الوصول.

إعجاب واحد (1)