I just ran into this on a forum I run. Repro steps:
Create a new group as an admin
Set visibility to “group owners”
Create group
Return to /g
Group will not show up
If you check the console by using Group.find_by(name: <name>) it returns correctly. Changing the visibility to “Group owners and staff” does return the visibility.
Unless this is by design, my assumption is that even admins should see groups at this visibility level (though not mods).
I didn’t notice this behavior until upgrading to 2.4.0.beta2 yesterday.
I can’t reproduce this @justin. I tried locally and on a DO hosted instance, and I tried creating a group from two different admin accounts. Admins in all cases see all groups.
Hi, I just changed a group’s visibility from “Group owners” to “Group owners, members” and it became visible again. I wonder if there is something quirky with the code for the setting for a group when its visibility is restricted to “Group owners”?
@outofthebox Do you by chance have the Babble chat plugin installed? Seems like it’s a regression relating to that after I removed it from my instance. Uninstalling that plug-in and rebuilding brought the group visibility back.
Nice find @justin, I had a quick look at the Babble source code, and there does seem to be a conflict with my updates to groups in core. Babble adds a hardcoded rule for visibility_level: 4, which now clashes with the owners group in core.
Ok, so I have dived into this issue a little deeper.
It seems like babble had assigned its own visibility_level for its own use, and took the next unused constant (4).
A few weeks ago, the Discourse core code added a new visiblity_level as well, and took the next unused constant, which was 4 as well. This caused a duplicate use of this constant.
So a fix would consist of two parts:
change the visibility_level used by babble. That would be easy. If we wanted to do this really neatly we would have each plugin register its own BASE_VISIBILITY_LEVEL in order to avoid future clashes. But for now we could just pick something (for instance 1001).
change the groups with visibility_level 4 to the new constant - but only the groups that were used by babble.
Would this query select the right groups @gdpelican ?
UPDATE groups
SET visibility_level = 1001
WHERE id IN (
SELECT g.id
FROM topics t
LEFT JOIN topic_allowed_groups tag ON tag.topic_id = t.id
LEFT JOIN groups g ON g.id = tag.group_id
WHERE t.archetype='chat');`
Hi sorry, I will take a look at this in the coming days, but your general outline of a fix is spot on. The back port will be the tricky part, I’ll have a closer look soon.