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
This commit is contained in:
parent
cf8bd89e78
commit
945f0bebf4
3 changed files with 62 additions and 26 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -108,14 +108,27 @@
|
|||
<h4 class="fw-bold">Email Form:</h4>
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li role="presentation" class="nav-item">
|
||||
<a class="nav-link active" href="#offender-<%= feedback_message.id %>" aria-controls="offender-<%= feedback_message.id %>" role="tab" data-toggle="tab">Offender</a>
|
||||
<a class="nav-link active" href="#reporter-<%= feedback_message.id %>" aria-controls="reporter-<%= feedback_message.id %>" role="tab" data-toggle="tab">Reporter</a>
|
||||
</li>
|
||||
<li role="presentation" class="nav-item">
|
||||
<a class="nav-link" href="#offender-<%= feedback_message.id %>" aria-controls="offender-<%= feedback_message.id %>" role="tab" data-toggle="tab">Offender</a>
|
||||
</li>
|
||||
<li role="presentation" class="nav-item">
|
||||
<a class="nav-link" href="#affected-<%= feedback_message.id %>" aria-controls="affected-<%= feedback_message.id %>" role="tab" data-toggle="tab">Affected</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content my-3">
|
||||
<div role="tabcard" class="tab-pane fade active show" data-id="<%= feedback_message.id %>" data-userType="offender" id="offender-<%= feedback_message.id %>">
|
||||
<div role="tabcard" class="tab-pane fade active show" data-id="<%= feedback_message.id %>" data-userType="reporter" id="reporter-<%= feedback_message.id %>">
|
||||
<div class="crayons-notice crayons-notice--info">Please note that all users who report abuse receive an automatic confirmation email. You can send an additional, follow-up email to this user by using the form below.</div>
|
||||
<br>
|
||||
<h5 class="fw-bold">Send To:</h5>
|
||||
<%= email_field_tag :reporter_email_to, feedback_message.reporter&.email, class: "form-control my-1", id: "reporter__emailto__#{feedback_message.id}", required: true %>
|
||||
<h5 class="fw-bold">Subject:</h5>
|
||||
<%= text_field_tag :reporter_email_subject, reporter_email_details[:subject], class: "form-control my-1", id: "reporter__subject__#{feedback_message.id}" %>
|
||||
<h5 class="fw-bold">Body:</h5>
|
||||
<%= text_area_tag :reporter_email_body, reporter_email_details[:body], class: "form-control my-1", style: "height: 300px;", id: "reporter__body__#{feedback_message.id}" %>
|
||||
</div>
|
||||
<div role="tabcard" class="tab-pane fade" data-id="<%= feedback_message.id %>" data-userType="offender" id="offender-<%= feedback_message.id %>">
|
||||
<h5 class="fw-bold">Send To:</h5>
|
||||
<%= email_field_tag :offender_email_to, feedback_message.offender&.email, class: "form-control my-1", id: "offender__emailto__#{feedback_message.id}", required: true %>
|
||||
<h5 class="fw-bold">Subject:</h5>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ require "rails_helper"
|
|||
|
||||
RSpec.describe FeedbackMessagesHelper, type: :helper do
|
||||
describe "#offender_email_details" do
|
||||
it "have proper subject and body" do
|
||||
it "has the proper subject and body" do
|
||||
expect(helper.offender_email_details).to include(
|
||||
subject: "#{SiteConfig.community_name} Code of Conduct Violation",
|
||||
body: a_string_starting_with("Hello"),
|
||||
|
|
@ -10,8 +10,17 @@ RSpec.describe FeedbackMessagesHelper, type: :helper do
|
|||
end
|
||||
end
|
||||
|
||||
describe "#reporter_email_details" do
|
||||
it "has the proper subject and body" do
|
||||
expect(helper.reporter_email_details).to include(
|
||||
subject: "#{SiteConfig.community_name} Report",
|
||||
body: a_string_starting_with("Hi"),
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#affected_email_details" do
|
||||
it "have proper subject and body" do
|
||||
it "has the proper subject and body" do
|
||||
expect(helper.affected_email_details).to include(
|
||||
subject: "Courtesy Notice from #{SiteConfig.community_name}",
|
||||
body: a_string_starting_with("Hi"),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue