FIX: Don't autojoin users when they have ready-only permissions (#20213)

After this change, in order to join a chat channel, a user needs to be in a group with at least “Reply” permission for the category. If the user only has “See” permission, they are able to preview the channel, but not join it or send messages. The auto-join function also follows this new restriction.

---------

Co-authored-by: Martin Brennan <martin@discourse.org>
This commit is contained in:
Jan Cernik
2023-05-10 08:45:13 -03:00
committed by GitHub
parent 56995e40c2
commit cbbaeb55b5
17 changed files with 233 additions and 59 deletions

View File

@@ -49,7 +49,6 @@ module CategoryGuardian
return false unless category
return false if is_anonymous?
return true if is_admin?
return true if !category.read_restricted
Category.post_create_allowed(self).exists?(id: category.id)
end