Skip to content

A platform for community discussion. Free, open, simple.

Add raw post content in "flagged post removed by staff" PM

Vinoth Kannan9cf401307321
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index 3e68a35e9f3..5d129aa819b 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -2405,9 +2405,13 @@ en:
text_body_template: |
Hello,
- This is an automated message from %{site_name} to let you know that your post was removed.
+ This is an automated message from %{site_name} to let you know that [your post](%{base_url}%{url}) was removed.
- <%{base_url}%{url}>
+ [details="Click to expand removed post"]
+ ```markdown
+ %{flagged_post_raw_content}
+ ```
+ [/details]
%{flag_reason}
diff --git a/lib/post_destroyer.rb b/lib/post_destroyer.rb
index efa292e91ef..8f48cd898e0 100644
--- a/lib/post_destroyer.rb
+++ b/lib/post_destroyer.rb
@@ -232,6 +232,7 @@ class PostDestroyer
user_id: @post.user_id,
message_type: :flags_agreed_and_post_deleted,
message_options: {
+ flagged_post_raw_content: @post.raw,
url: @post.url,
flag_reason: I18n.t(
"flag_reasons.#{@post.active_flags.last.post_action_type.name_key}",
diff --git a/spec/components/post_destroyer_spec.rb b/spec/components/post_destroyer_spec.rb
index e29543b7f4a..845a3ba3c2a 100644
--- a/spec/components/post_destroyer_spec.rb
+++ b/spec/components/post_destroyer_spec.rb
@@ -650,7 +650,12 @@ describe PostDestroyer do
expect(second_post.bookmark_count).to eq(0)
expect(second_post.off_topic_count).to eq(1)
- expect(Jobs::SendSystemMessage.jobs.size).to eq(1)
+ jobs = Jobs::SendSystemMessage.jobs
+ expect(jobs.size).to eq(1)
+
+ Jobs::SendSystemMessage.new.execute(jobs[0]["args"][0].with_indifferent_access)
+
+ expect(Post.last.raw).to include("[details=\"Click to expand removed post\"]\n```markdown\n#{second_post.raw}\n```\n[/details]")
end
it "should not send the flags_agreed_and_post_deleted message if it was deleted by system" do