From 5849c81f1d44e91c5391a98453564c449b747c41 Mon Sep 17 00:00:00 2001 From: Bianca Nenciu Date: Wed, 25 Jan 2023 15:09:38 +0200 Subject: [PATCH] Revert "FIX: TL4 user can see deleted topics (#19946)" This reverts commit d725c41d186b8910eb2a6cc7264317537c1e654d which is a 3.1 feature. --- lib/guardian/topic_guardian.rb | 3 +-- spec/lib/guardian/topic_guardian_spec.rb | 21 --------------------- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/lib/guardian/topic_guardian.rb b/lib/guardian/topic_guardian.rb index baa8d87a9a2..05fb6ad041d 100644 --- a/lib/guardian/topic_guardian.rb +++ b/lib/guardian/topic_guardian.rb @@ -209,8 +209,7 @@ module TopicGuardian end def can_see_deleted_topics?(category) - is_staff? || is_category_group_moderator?(category) || - (SiteSetting.tl4_delete_posts_and_topics && user.has_trust_level?(TrustLevel[4])) + is_staff? || is_category_group_moderator?(category) end # Accepts an array of `Topic#id` and returns an array of `Topic#id` which the user can see. diff --git a/spec/lib/guardian/topic_guardian_spec.rb b/spec/lib/guardian/topic_guardian_spec.rb index 07a0041bd6a..94ff370848f 100644 --- a/spec/lib/guardian/topic_guardian_spec.rb +++ b/spec/lib/guardian/topic_guardian_spec.rb @@ -74,27 +74,6 @@ RSpec.describe TopicGuardian do end end - describe "#can_see_deleted_topics?" do - it "returns true for staff" do - expect(Guardian.new(admin).can_see_deleted_topics?(topic.category)).to eq(true) - end - - it "returns true for group moderator" do - SiteSetting.enable_category_group_moderation = true - expect(Guardian.new(user).can_see_deleted_topics?(topic.category)).to eq(false) - category.update!(reviewable_by_group_id: group.id) - group.add(user) - topic.update!(category: category) - expect(Guardian.new(user).can_see_deleted_topics?(topic.category)).to eq(true) - end - - it "returns true when tl4 can delete posts and topics" do - expect(Guardian.new(tl4_user).can_see_deleted_topics?(topic.category)).to eq(false) - SiteSetting.tl4_delete_posts_and_topics = true - expect(Guardian.new(tl4_user).can_see_deleted_topics?(topic.category)).to eq(true) - end - end - describe "#can_edit_topic?" do context "when the topic is a shared draft" do let(:tl2_user) { Fabricate(:user, trust_level: TrustLevel[2]) }