mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 22:09:12 +08:00
Can clear flags on deleted posts if you're a moderator
This commit is contained in:
@ -68,6 +68,29 @@ describe Guardian do
|
||||
end
|
||||
|
||||
|
||||
describe "can_clear_flags" do
|
||||
let(:post) { Fabricate(:post) }
|
||||
let(:user) { post.user }
|
||||
let(:moderator) { Fabricate(:moderator) }
|
||||
|
||||
it "returns false when the user is nil" do
|
||||
Guardian.new(nil).can_clear_flags?(post).should be_false
|
||||
end
|
||||
|
||||
it "returns false when the post is nil" do
|
||||
Guardian.new(moderator).can_clear_flags?(nil).should be_false
|
||||
end
|
||||
|
||||
it "returns false when the user is not a moderator" do
|
||||
Guardian.new(user).can_clear_flags?(post).should be_false
|
||||
end
|
||||
|
||||
it "returns true when the user is a moderator" do
|
||||
Guardian.new(moderator).can_clear_flags?(post).should be_true
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe 'can_send_private_message' do
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:another_user) { Fabricate(:user) }
|
||||
|
Reference in New Issue
Block a user