A platform for community discussion. Free, open, simple.
FIX: Staff should be allowed to ignore users (#7216)
Tarek Khaliled73cc60a99a
diff --git a/lib/guardian.rb b/lib/guardian.rbindex 3bab77eefbf..7bcc15971c7 100644--- a/lib/guardian.rb+++ b/lib/guardian.rb@@ -392,7 +392,7 @@ class Guardiandef can_ignore_user?(user_id)@user.id != user_id &&- @user.trust_level >= TrustLevel.levels[:member] &&+ (@user.staff? || @user.trust_level >= TrustLevel.levels[:member]) &&User.where(id: user_id, admin: false, moderator: false).exists?enddiff --git a/spec/components/guardian_spec.rb b/spec/components/guardian_spec.rbindex e0417a79593..eb4008efc1f 100644--- a/spec/components/guardian_spec.rb+++ b/spec/components/guardian_spec.rb@@ -2675,6 +2675,15 @@ describe Guardian doendend+ context "when ignorer is staff" do+ let(:guardian) { Guardian.new(admin) }+ let!(:another_user) { Fabricate(:user) }++ it 'allows ignoring user' do+ expect(guardian.can_ignore_user?(another_user.id)).to eq(true)+ end+ end+context "when ignorer's trust level is tl2" dolet(:guardian) { Guardian.new(trust_level_2) }let!(:another_user) { Fabricate(:user) }