FIX: Clean flagged queue when response to flagged post deleted (#15463)

This commit is contained in:
janzenisaac 2022-01-05 12:37:15 -06:00 committed by GitHub
parent c5fd8c42db
commit 22e8f8af6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -2929,6 +2929,12 @@ en:
%{flagged_post_raw_content} %{flagged_post_raw_content}
``` ```
To which you responded
``` markdown
%{flagged_post_response_raw_content}
```
For more details on the reason for removal, please review our [community guidelines](%{base_url}/guidelines). For more details on the reason for removal, please review our [community guidelines](%{base_url}/guidelines).
usage_tips: usage_tips:

View File

@ -183,6 +183,7 @@ class PostDestroyer
DB.after_commit do DB.after_commit do
if @opts[:reviewable] if @opts[:reviewable]
notify_deletion(@opts[:reviewable], { notify_responders: @opts[:notify_responders], parent_post: @opts[:parent_post] }) notify_deletion(@opts[:reviewable], { notify_responders: @opts[:notify_responders], parent_post: @opts[:parent_post] })
ignore(@post.reviewable_flag) if @post.reviewable_flag && SiteSetting.notify_users_after_responses_deleted_on_flagged_post
elsif reviewable = @post.reviewable_flag elsif reviewable = @post.reviewable_flag
@opts[:defer_flags] ? ignore(reviewable) : agree(reviewable) @opts[:defer_flags] ? ignore(reviewable) : agree(reviewable)
end end
@ -332,6 +333,7 @@ class PostDestroyer
message_type: notify_responders ? :flags_agreed_and_post_deleted_for_responders : :flags_agreed_and_post_deleted, message_type: notify_responders ? :flags_agreed_and_post_deleted_for_responders : :flags_agreed_and_post_deleted,
message_options: { message_options: {
flagged_post_raw_content: notify_responders ? options[:parent_post].raw : @post.raw, flagged_post_raw_content: notify_responders ? options[:parent_post].raw : @post.raw,
flagged_post_response_raw_content: @post.raw,
url: notify_responders ? options[:parent_post].url : @post.url, url: notify_responders ? options[:parent_post].url : @post.url,
flag_reason: I18n.t( flag_reason: I18n.t(
"flag_reasons#{".responder" if notify_responders}.#{PostActionType.types[rs.reviewable_score_type]}", "flag_reasons#{".responder" if notify_responders}.#{PostActionType.types[rs.reviewable_score_type]}",