A staff member can hide another staff's member's post by flagging
This commit is contained in:
parent
d0e7898fa0
commit
b39fbf7187
|
@ -542,7 +542,8 @@ SQL
|
|||
end
|
||||
|
||||
def self.auto_hide_if_needed(acting_user, post, post_action_type)
|
||||
return if post.hidden || post.user.staff?
|
||||
return if post.hidden?
|
||||
return if (!acting_user.staff?) && post.user.staff?
|
||||
|
||||
if post_action_type == :spam &&
|
||||
acting_user.has_trust_level?(TrustLevel[3]) &&
|
||||
|
|
|
@ -382,7 +382,7 @@ describe PostAction do
|
|||
expect(post.spam_count).to eq(0)
|
||||
end
|
||||
|
||||
it "will not auto hide staff posts" do
|
||||
it "will not allow regular users to auto hide staff posts" do
|
||||
mod = Fabricate(:moderator)
|
||||
post = Fabricate(:post, user: mod)
|
||||
|
||||
|
@ -398,6 +398,22 @@ describe PostAction do
|
|||
expect(post.hidden_at).to be_blank
|
||||
end
|
||||
|
||||
it "allows staff users to auto hide staff posts" do
|
||||
mod = Fabricate(:moderator)
|
||||
post = Fabricate(:post, user: mod)
|
||||
|
||||
SiteSetting.flags_required_to_hide_post = 2
|
||||
Discourse.stubs(:site_contact_user).returns(admin)
|
||||
|
||||
PostAction.act(eviltrout, post, PostActionType.types[:spam])
|
||||
PostAction.act(Fabricate(:admin), post, PostActionType.types[:spam])
|
||||
|
||||
post.reload
|
||||
|
||||
expect(post.hidden).to eq(true)
|
||||
expect(post.hidden_at).to be_present
|
||||
end
|
||||
|
||||
it 'should follow the rules for automatic hiding workflow' do
|
||||
post = create_post
|
||||
walterwhite = Fabricate(:walter_white)
|
||||
|
|
Loading…
Reference in New Issue