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

This commit is contained in:
Vinoth Kannan 2019-01-18 01:33:55 +05:30
parent 3c987132cb
commit 2818afb267
2 changed files with 7 additions and 0 deletions

View File

@ -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])

View File

@ -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)