A platform for community discussion. Free, open, simple.
A staff member can hide another staff's member's post by flagging
Robin Wardb39fbf71873b
diff --git a/app/models/post_action.rb b/app/models/post_action.rbindex 471cebe9aba..db6892e1e8e 100644--- a/app/models/post_action.rb+++ b/app/models/post_action.rb@@ -542,7 +542,8 @@ SQLenddef 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]) &&diff --git a/spec/models/post_action_spec.rb b/spec/models/post_action_spec.rbindex 02b205276f7..18a38e484ac 100644--- a/spec/models/post_action_spec.rb+++ b/spec/models/post_action_spec.rb@@ -382,7 +382,7 @@ describe PostAction doexpect(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" domod = Fabricate(:moderator)post = Fabricate(:post, user: mod)@@ -398,6 +398,22 @@ describe PostAction doexpect(post.hidden_at).to be_blankend+ 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' dopost = create_postwalterwhite = Fabricate(:walter_white)