diff --git a/app/models/post_action.rb b/app/models/post_action.rb index 617d0c72b3b..8bcb64482b3 100644 --- a/app/models/post_action.rb +++ b/app/models/post_action.rb @@ -538,7 +538,7 @@ SQL end def self.auto_hide_if_needed(acting_user, post, post_action_type) - return if post.hidden + return if post.hidden || 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.rb index 9c742835dfe..b22abb3b199 100644 --- a/spec/models/post_action_spec.rb +++ b/spec/models/post_action_spec.rb @@ -362,6 +362,22 @@ describe PostAction do expect(post.spam_count).to eq(0) end + it "will not 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(:walter_white), post, PostActionType.types[:spam]) + + post.reload + + expect(post.hidden).to eq(false) + expect(post.hidden_at).to be_blank + end + it 'should follow the rules for automatic hiding workflow' do post = create_post walterwhite = Fabricate(:walter_white)