FIX: Do not hide posts automatically when flagged by staff user

FIX: Do not hide posts automatically when flagged by staff user

diff --git a/app/models/post_action.rb b/app/models/post_action.rb
index a042a6e..055c5d1 100644
--- a/app/models/post_action.rb
+++ b/app/models/post_action.rb
@@ -613,6 +613,7 @@ class PostAction < ActiveRecord::Base
     elsif PostActionType.auto_action_flag_types.include?(post_action_type)
 
       if acting_user.has_trust_level?(TrustLevel[4]) &&
+         !acting_user.staff? &&
          post.user&.trust_level != TrustLevel[4]
 
         hide_post!(post, post_action_type, Post.hidden_reasons[:flagged_by_tl4_user])
diff --git a/spec/models/post_action_spec.rb b/spec/models/post_action_spec.rb
index 8038c78..d17b664 100644
--- a/spec/models/post_action_spec.rb
+++ b/spec/models/post_action_spec.rb
@@ -824,6 +824,12 @@ describe PostAction do
 
       expect(post.hidden).to be_falsey
 
+      post = create_post(user: user)
+      PostAction.act(Fabricate(:moderator), post, post_action_type)
+      post.reload
+
+      expect(post.hidden).to be_falsey
+
       user = Fabricate(:trust_level_4)
       post = create_post(user: user)
       PostAction.act(tl4_user, post, post_action_type)

GitHub sha: 2818afb2

1 Like

This commit has been mentioned on Discourse Meta. There might be relevant details there: