Skip to content

A platform for community discussion. Free, open, simple.

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

Vinoth Kannan2818afb2678e
diff --git a/app/models/post_action.rb b/app/models/post_action.rb
index a042a6e218c..055c5d14898 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 8038c7865c2..d17b6647155 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)