mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: automatically hide non-TL4 posts when flagged by a TL4 user
This commit is contained in:
@@ -117,7 +117,8 @@ class Post < ActiveRecord::Base
|
||||
flag_threshold_reached_again: 2,
|
||||
new_user_spam_threshold_reached: 3,
|
||||
flagged_by_tl3_user: 4,
|
||||
email_spam_header_found: 5)
|
||||
email_spam_header_found: 5,
|
||||
flagged_by_tl4_user: 6)
|
||||
end
|
||||
|
||||
def self.types
|
||||
|
||||
@@ -583,13 +583,19 @@ class PostAction < ActiveRecord::Base
|
||||
|
||||
hide_post!(post, post_action_type, Post.hidden_reasons[:flagged_by_tl3_user])
|
||||
|
||||
elsif PostActionType.auto_action_flag_types.include?(post_action_type) &&
|
||||
SiteSetting.flags_required_to_hide_post > 0
|
||||
elsif PostActionType.auto_action_flag_types.include?(post_action_type)
|
||||
|
||||
_old_flags, new_flags = PostAction.flag_counts_for(post.id)
|
||||
if acting_user.has_trust_level?(TrustLevel[4]) &&
|
||||
post.user&.trust_level != TrustLevel[4]
|
||||
|
||||
if new_flags >= SiteSetting.flags_required_to_hide_post
|
||||
hide_post!(post, post_action_type, guess_hide_reason(post))
|
||||
hide_post!(post, post_action_type, Post.hidden_reasons[:flagged_by_tl4_user])
|
||||
elsif SiteSetting.flags_required_to_hide_post > 0
|
||||
|
||||
_old_flags, new_flags = PostAction.flag_counts_for(post.id)
|
||||
|
||||
if new_flags >= SiteSetting.flags_required_to_hide_post
|
||||
hide_post!(post, post_action_type, guess_hide_reason(post))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user