mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Don't notify of post deletion when agreeing with automatic flags. (#19241)
This commit is contained in:
@@ -330,6 +330,12 @@ class PostDestroyer
|
||||
allowed_user = @user.human? && @user.staff?
|
||||
return unless allowed_user && rs = reviewable.reviewable_scores.order('created_at DESC').first
|
||||
|
||||
# ReviewableScore#types is a superset of PostActionType#flag_types.
|
||||
# If the reviewable score type is not on the latter, it means it's not a flag by a user and
|
||||
# must be an automated flag like `needs_approval`. There's no flag reason for these kind of types.
|
||||
flag_type = PostActionType.flag_types[rs.reviewable_score_type]
|
||||
return unless flag_type
|
||||
|
||||
notify_responders = options[:notify_responders]
|
||||
|
||||
Jobs.enqueue(
|
||||
@@ -341,7 +347,7 @@ class PostDestroyer
|
||||
flagged_post_response_raw_content: @post.raw,
|
||||
url: notify_responders ? options[:parent_post].url : @post.url,
|
||||
flag_reason: I18n.t(
|
||||
"flag_reasons#{".responder" if notify_responders}.#{PostActionType.types[rs.reviewable_score_type]}",
|
||||
"flag_reasons#{".responder" if notify_responders}.#{flag_type}",
|
||||
locale: SiteSetting.default_locale,
|
||||
base_path: Discourse.base_path
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user