mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 18:30:26 -06:00
FIX: Staff should be allowed to ignore users (#7216)
This commit is contained in:
parent
5852e86226
commit
ed73cc60a9
@ -392,7 +392,7 @@ class Guardian
|
||||
|
||||
def 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?
|
||||
end
|
||||
|
||||
|
@ -2675,6 +2675,15 @@ describe Guardian do
|
||||
end
|
||||
end
|
||||
|
||||
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" do
|
||||
let(:guardian) { Guardian.new(trust_level_2) }
|
||||
let!(:another_user) { Fabricate(:user) }
|
||||
|
Loading…
Reference in New Issue
Block a user