mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 04:18:27 +08:00
FEATURE: Support designating multiple groups as mods on category (#28655)
Currently, categories support designating only 1 group as a moderation group on the category. This commit removes the one group limitation and makes it possible to designate multiple groups as mods on a category. Internal topic: t/124648.
This commit is contained in:
@ -354,11 +354,11 @@ RSpec.describe Chat::GuardianExtensions do
|
||||
context "when enable_category_group_moderation is true" do
|
||||
before { SiteSetting.enable_category_group_moderation = true }
|
||||
|
||||
it "returns true if the regular user is part of the reviewable_by_group for the category" do
|
||||
it "returns true if the regular user is part of the reviewable groups for the category" do
|
||||
moderator = Fabricate(:user)
|
||||
mods = Fabricate(:group)
|
||||
mods.add(moderator)
|
||||
category.update!(reviewable_by_group: mods)
|
||||
Fabricate(:category_moderation_group, category:, group: mods)
|
||||
expect(Guardian.new(Fabricate(:admin)).can_moderate_chat?(channel.chatable)).to eq(true)
|
||||
expect(Guardian.new(moderator).can_moderate_chat?(channel.chatable)).to eq(true)
|
||||
end
|
||||
@ -443,7 +443,7 @@ RSpec.describe Chat::GuardianExtensions do
|
||||
moderator = Fabricate(:user)
|
||||
mods = Fabricate(:group)
|
||||
mods.add(moderator)
|
||||
chatable.update!(reviewable_by_group: mods)
|
||||
Fabricate(:category_moderation_group, category: chatable, group: mods)
|
||||
expect(Guardian.new(moderator).can_restore_chat?(message, chatable)).to eq(true)
|
||||
end
|
||||
end
|
||||
|
@ -28,12 +28,14 @@ RSpec.describe "Move message to channel", type: :system do
|
||||
fab!(:group_1) { Fabricate(:group) }
|
||||
fab!(:channel_1) { Fabricate(:private_category_channel, group: group_1) }
|
||||
fab!(:message_1) { Fabricate(:chat_message, chat_channel: channel_1, user: current_user) }
|
||||
fab!(:category_moderation_group) do
|
||||
Fabricate(:category_moderation_group, category: channel_1.category, group: group_1)
|
||||
end
|
||||
|
||||
before do
|
||||
SiteSetting.enable_category_group_moderation = true
|
||||
group_1.add(current_user)
|
||||
channel_1.add(current_user)
|
||||
channel_1.chatable.update!(reviewable_by_group_id: group_1.id)
|
||||
end
|
||||
|
||||
it "is available" do
|
||||
|
Reference in New Issue
Block a user