Revert "FIX: Allow category moderators to move topics to their categories" (#23810)

This reverts commit 70be873b9cde37fdf78fb62b9020958c8599cac9.
This commit is contained in:
Sam
2023-10-06 12:00:22 +11:00
committed by GitHub
parent ed905094eb
commit f21a4a6cb3
5 changed files with 4 additions and 157 deletions

View File

@ -4,11 +4,9 @@ RSpec.describe CategoryGuardian do
fab!(:admin) { Fabricate(:admin) }
fab!(:user) { Fabricate(:user) }
fab!(:can_create_user) { Fabricate(:user) }
fab!(:category) do
Fabricate(:category, category_setting_attributes: { require_topic_approval: false })
end
describe "can_post_in_category?" do
fab!(:category) { Fabricate(:category) }
context "when not restricted category" do
it "returns false for anonymous user" do
expect(Guardian.new.can_post_in_category?(category)).to eq(false)
@ -79,59 +77,4 @@ RSpec.describe CategoryGuardian do
end
end
end
describe "#topics_need_approval?" do
fab!(:reviewable_group) { Fabricate(:group) }
it "returns false when admin" do
expect(Guardian.new(admin).topics_need_approval?(category)).to eq(false)
end
it "returns the value of require_topic_approval when group moderation is off" do
SiteSetting.enable_category_group_moderation = false
category.require_topic_approval = false
category.save!
expect(Guardian.new(user).topics_need_approval?(category)).to eq(false)
category.require_topic_approval = true
category.save!
expect(Guardian.new(user).topics_need_approval?(category)).to eq(true)
end
it "returns the value of require_topic_approval when group moderation is on and there are no groups set" do
SiteSetting.enable_category_group_moderation = true
category.reviewable_by_group_id = nil
category.require_topic_approval = false
category.save!
expect(Guardian.new(user).topics_need_approval?(category)).to eq(false)
category.require_topic_approval = true
category.save!
expect(Guardian.new(user).topics_need_approval?(category)).to eq(true)
end
it "returns false when group moderation is on and the user is in the reviewable group" do
SiteSetting.enable_category_group_moderation = true
category.require_topic_approval = true
category.reviewable_by_group_id = reviewable_group.id
category.save!
Fabricate(:group_user, group: reviewable_group, user: user)
expect(Guardian.new(user).topics_need_approval?(category)).to eq(false)
end
it "returns true when group moderation is on and the user is not in the reviewable group" do
SiteSetting.enable_category_group_moderation = true
category.require_topic_approval = false
category.reviewable_by_group_id = Fabricate(:group).id
category.save!
expect(Guardian.new(user).topics_need_approval?(category)).to eq(true)
end
end
end