FEATURE: Add new don't feed the trolls feature (#21001)

Responding to negative behaviour tends to solicit more of the same. Common wisdom states: "don't feed the trolls".

This change codifies that advice by introducing a new nudge when hitting the reply button on a flagged post. It will be shown if either the current user, or two other users (configurable via a site setting) have flagged the post.
This commit is contained in:
Ted Johansson
2023-04-20 15:49:35 +08:00
committed by GitHub
parent 351e3ccd98
commit e002a24eca
8 changed files with 142 additions and 1 deletions

View File

@@ -550,10 +550,14 @@ class Post < ActiveRecord::Base
end
def is_flagged?
flags.count != 0
end
def flags
post_actions.where(
post_action_type_id: PostActionType.flag_types_without_custom.values,
deleted_at: nil,
).count != 0
)
end
def reviewable_flag