From 945f0bebf45dc0db6a75b70364c2a91a46417371 Mon Sep 17 00:00:00 2001 From: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com> Date: Mon, 22 Mar 2021 08:19:05 -0600 Subject: [PATCH] Re-Add Reporter Email Form to /admin/reports (#13011) [deploy] * Re-add Reporter email form and add heads up banner to admin/reports * Adjusts spec expectations to read in a nicer way * Pulls HEREDOCs out into constants and formats email bodys inline - Additionally, fixes inconsistent grammar within all email bodies --- app/helpers/feedback_messages_helper.rb | 58 ++++++++++++------- .../_feedback_message.html.erb | 17 +++++- spec/helpers/feedback_messages_helper_spec.rb | 13 ++++- 3 files changed, 62 insertions(+), 26 deletions(-) diff --git a/app/helpers/feedback_messages_helper.rb b/app/helpers/feedback_messages_helper.rb index a9dc2ffe8..3177557e1 100644 --- a/app/helpers/feedback_messages_helper.rb +++ b/app/helpers/feedback_messages_helper.rb @@ -1,31 +1,45 @@ module FeedbackMessagesHelper + OFFENDER_EMAIL_BODY = <<~HEREDOC.freeze + Hello, + + It has been brought to our attention that you have violated the #{SiteConfig.community_name} Code of Conduct and/or Terms of Use. + + If this behavior continues, we may need to suspend your #{SiteConfig.community_name} account. + + If you think that there's been a mistake, please reply to this email and we will take another look. + + #{SiteConfig.community_name} Team + HEREDOC + + REPORTER_EMAIL_BODY = <<~HEREDOC.freeze + Hi there, + Thank you for flagging content that may be in violation of the #{SiteConfig.community_name} Code of Conduct and/or our Terms of Use. We are looking into your report and will take appropriate action. + We appreciate your help as we work to foster a positive and inclusive environment for all! + #{SiteConfig.community_name} Team + HEREDOC + + AFFECTED_EMAIL_BODY = <<~HEREDOC.freeze + Hi there, + + We noticed some comments (made by others) on your post that violate the #{SiteConfig.community_name} Code of Conduct and/or our Terms of Use. We have zero tolerance for such behavior and are taking appropriate action. + + Thanks for being awesome, and please don't hesitate to email us with any questions! We welcome all feedback and ideas as we continue working to foster an open and inclusive community. + + #{SiteConfig.community_name} Team + HEREDOC + def offender_email_details - body = <<~HEREDOC - Hello, - - It has been brought to our attention that you have violated the #{SiteConfig.community_name} Code of Conduct and/or Terms of Use. - - If this behavior continues, we may need to suspend your #{SiteConfig.community_name} account. - - If you think that there's been a mistake, please reply to this email and we will take another look. - - #{SiteConfig.community_name} Team - HEREDOC - + body = format(OFFENDER_EMAIL_BODY) { subject: "#{SiteConfig.community_name} Code of Conduct Violation", body: body }.freeze end + def reporter_email_details + body = format(REPORTER_EMAIL_BODY) + { subject: "#{SiteConfig.community_name} Report", body: body }.freeze + end + def affected_email_details - body = <<~HEREDOC - Hi there, - - We noticed some comments (made by others) on your post that violate the #{SiteConfig.community_name} Code of Conduct and/or our Terms of Use. We have zero tolerance for such behavior and are taking appropriate action. - - Thanks for being awesome, and please don't hesitate to email us with any questions! We welcome all feedback and ideas as we continue working to foster an open and inclusive community. - - #{SiteConfig.community_name} Team - HEREDOC - + body = format(AFFECTED_EMAIL_BODY) { subject: "Courtesy Notice from #{SiteConfig.community_name}", body: body }.freeze end end diff --git a/app/views/admin/feedback_messages/_feedback_message.html.erb b/app/views/admin/feedback_messages/_feedback_message.html.erb index 46cda8b79..25efddeea 100644 --- a/app/views/admin/feedback_messages/_feedback_message.html.erb +++ b/app/views/admin/feedback_messages/_feedback_message.html.erb @@ -108,14 +108,27 @@