FIX: Do not show visibility topic if visible (#16478)

It used to show the warning that said only members of certain groups
could view the topic even if the group "everyone" was listed in
category's permission list.
This commit is contained in:
Bianca Nenciu
2022-04-18 11:16:30 +03:00
committed by GitHub
parent c81d4597a7
commit 234cf65e39
2 changed files with 25 additions and 3 deletions

View File

@ -255,7 +255,12 @@ class CategoriesController < ApplicationController
def visible_groups
@guardian.ensure_can_see!(@category)
render json: success_json.merge(groups: @category.groups.merge(Group.visible_groups(current_user)).pluck("name"))
groups = if !@category.groups.exists?(id: Group::AUTO_GROUPS[:everyone])
@category.groups.merge(Group.visible_groups(current_user)).pluck("name")
end
render json: success_json.merge(groups: groups || [])
end
private