mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 11:47:15 +08:00
FIX: allows PM owner to remove any user if >= TL2 (#10036)
This commit is contained in:
@ -3446,8 +3446,23 @@ describe Guardian do
|
||||
end
|
||||
end
|
||||
|
||||
context 'trust_level >= 2 user' do
|
||||
fab!(:topic_creator) { build(:user, trust_level: 2) }
|
||||
fab!(:topic) { Fabricate(:topic, user: topic_creator) }
|
||||
|
||||
before do
|
||||
topic.allowed_users << topic_creator
|
||||
topic.allowed_users << another_user
|
||||
end
|
||||
|
||||
it 'should be true' do
|
||||
expect(Guardian.new(topic_creator).can_remove_allowed_users?(topic))
|
||||
.to eq(true)
|
||||
end
|
||||
end
|
||||
|
||||
context 'normal user' do
|
||||
fab!(:topic) { Fabricate(:topic, user: Fabricate(:user)) }
|
||||
fab!(:topic) { Fabricate(:topic, user: Fabricate(:user, trust_level: 1)) }
|
||||
|
||||
before do
|
||||
topic.allowed_users << user
|
||||
|
Reference in New Issue
Block a user