From b8b3df1453c0cfb6d0107d58842c97e261eda872 Mon Sep 17 00:00:00 2001
From: Andrew White
Date: Tue, 29 Oct 2024 08:01:02 +0000
Subject: [PATCH 01/10] Extract common patterns to partials
---
app/views/application_mailer/_footer.html.erb | 5 +++++
app/views/application_mailer/_footer.text.erb | 5 +++++
app/views/application_mailer/_reason.html.erb | 8 ++++++++
app/views/application_mailer/_reason.text.erb | 12 ++++++++++++
app/views/application_mailer/_unsubscribe.html.erb | 3 +++
app/views/application_mailer/_unsubscribe.text.erb | 4 ++++
.../petition_mailer/email_creator.html.erb | 14 +++-----------
.../petition_mailer/email_creator.text.erb | 14 +++-----------
.../archived/petition_mailer/email_signer.html.erb | 14 +++-----------
.../archived/petition_mailer/email_signer.text.erb | 14 +++-----------
.../petition_mailer/mailshot_for_creator.html.erb | 14 +++-----------
.../petition_mailer/mailshot_for_creator.text.erb | 14 +++-----------
.../petition_mailer/mailshot_for_signer.html.erb | 14 +++-----------
.../petition_mailer/mailshot_for_signer.text.erb | 14 +++-----------
.../notify_creator_of_debate_outcome.html.erb | 14 +++-----------
.../notify_creator_of_debate_outcome.text.erb | 14 +++-----------
.../notify_creator_of_debate_scheduled.html.erb | 14 +++-----------
.../notify_creator_of_debate_scheduled.text.erb | 14 +++-----------
.../notify_creator_of_threshold_response.html.erb | 14 +++-----------
.../notify_creator_of_threshold_response.text.erb | 14 +++-----------
.../notify_signer_of_debate_outcome.html.erb | 14 +++-----------
.../notify_signer_of_debate_outcome.text.erb | 14 +++-----------
.../notify_signer_of_debate_scheduled.html.erb | 14 +++-----------
.../notify_signer_of_debate_scheduled.text.erb | 14 +++-----------
.../notify_signer_of_threshold_response.html.erb | 14 +++-----------
.../notify_signer_of_threshold_response.text.erb | 14 +++-----------
.../email_confirmation_for_signer.html.erb | 4 +---
.../email_confirmation_for_signer.text.erb | 4 +---
app/views/petition_mailer/email_creator.html.erb | 14 +++-----------
app/views/petition_mailer/email_creator.text.erb | 14 +++-----------
.../email_duplicate_signatures.html.erb | 4 +---
.../email_duplicate_signatures.text.erb | 4 +---
app/views/petition_mailer/email_signer.html.erb | 14 +++-----------
app/views/petition_mailer/email_signer.text.erb | 14 +++-----------
.../gather_sponsors_for_petition.html.erb | 4 +---
.../gather_sponsors_for_petition.text.erb | 4 +---
.../petition_mailer/mailshot_for_creator.html.erb | 14 +++-----------
.../petition_mailer/mailshot_for_creator.text.erb | 14 +++-----------
.../petition_mailer/mailshot_for_signer.html.erb | 14 +++-----------
.../petition_mailer/mailshot_for_signer.text.erb | 14 +++-----------
.../notify_creator_of_closing_date_change.html.erb | 4 +---
.../notify_creator_of_closing_date_change.text.erb | 4 +---
.../notify_creator_of_debate_outcome.html.erb | 14 +++-----------
.../notify_creator_of_debate_outcome.text.erb | 14 +++-----------
.../notify_creator_of_debate_scheduled.html.erb | 14 +++-----------
.../notify_creator_of_debate_scheduled.text.erb | 14 +++-----------
...or_of_sponsored_petition_being_stopped.html.erb | 4 +---
...or_of_sponsored_petition_being_stopped.text.erb | 4 +---
.../notify_creator_of_threshold_response.html.erb | 14 +++-----------
.../notify_creator_of_threshold_response.text.erb | 14 +++-----------
...or_of_validated_petition_being_stopped.html.erb | 4 +---
...or_of_validated_petition_being_stopped.text.erb | 4 +---
...ify_creator_that_moderation_is_delayed.html.erb | 14 +++-----------
...ify_creator_that_moderation_is_delayed.text.erb | 14 +++-----------
...ify_creator_that_petition_is_published.html.erb | 4 +---
...ify_creator_that_petition_is_published.text.erb | 4 +---
...ify_creator_that_petition_was_rejected.html.erb | 4 +---
...ify_creator_that_petition_was_rejected.text.erb | 4 +---
.../notify_signer_of_closing_date_change.html.erb | 4 +---
.../notify_signer_of_closing_date_change.text.erb | 4 +---
.../notify_signer_of_debate_outcome.html.erb | 14 +++-----------
.../notify_signer_of_debate_outcome.text.erb | 14 +++-----------
.../notify_signer_of_debate_scheduled.html.erb | 14 +++-----------
.../notify_signer_of_debate_scheduled.text.erb | 14 +++-----------
.../notify_signer_of_threshold_response.html.erb | 14 +++-----------
.../notify_signer_of_threshold_response.text.erb | 14 +++-----------
...ify_sponsor_that_petition_is_published.html.erb | 4 +---
...ify_sponsor_that_petition_is_published.text.erb | 4 +---
...ify_sponsor_that_petition_was_rejected.html.erb | 4 +---
...ify_sponsor_that_petition_was_rejected.text.erb | 4 +---
...esend_of_email_confirmation_for_signer.html.erb | 4 +---
...esend_of_email_confirmation_for_signer.text.erb | 4 +---
.../sponsor_signed_email_below_threshold.html.erb | 4 +---
.../sponsor_signed_email_below_threshold.text.erb | 4 +---
.../sponsor_signed_email_on_threshold.html.erb | 4 +---
.../sponsor_signed_email_on_threshold.text.erb | 4 +---
76 files changed, 191 insertions(+), 546 deletions(-)
create mode 100644 app/views/application_mailer/_footer.html.erb
create mode 100644 app/views/application_mailer/_footer.text.erb
create mode 100644 app/views/application_mailer/_reason.html.erb
create mode 100644 app/views/application_mailer/_reason.text.erb
create mode 100644 app/views/application_mailer/_unsubscribe.html.erb
create mode 100644 app/views/application_mailer/_unsubscribe.text.erb
diff --git a/app/views/application_mailer/_footer.html.erb b/app/views/application_mailer/_footer.html.erb
new file mode 100644
index 000000000..a56800206
--- /dev/null
+++ b/app/views/application_mailer/_footer.html.erb
@@ -0,0 +1,5 @@
+<%# locals: (closing: "Thanks") -%>
+<%= closing %>,
+
+<%= t("petitions.emails.signoff_prefix") %>
+<%= t("petitions.emails.signoff_suffix") %>
diff --git a/app/views/application_mailer/_footer.text.erb b/app/views/application_mailer/_footer.text.erb
new file mode 100644
index 000000000..ca3b22325
--- /dev/null
+++ b/app/views/application_mailer/_footer.text.erb
@@ -0,0 +1,5 @@
+<%# locals: (closing: "Thanks") -%>
+<%= closing %>,
+
+<%= t("petitions.emails.signoff_prefix") %>
+<%= t("petitions.emails.signoff_suffix") %>
diff --git a/app/views/application_mailer/_reason.html.erb b/app/views/application_mailer/_reason.html.erb
new file mode 100644
index 000000000..6f2ebdf43
--- /dev/null
+++ b/app/views/application_mailer/_reason.html.erb
@@ -0,0 +1,8 @@
+<% if @signature.creator? %>
+You’re receiving this email because you created the petition: “<%= link_to @petition.action, [@petition] %>”.
+<% elsif @signature.sponsor? %>
+You’re receiving this email because you supported the petition: “<%= link_to @petition.action, [@petition] %>”.
+<% else %>
+You’re receiving this email because you signed the petition: “<%= link_to @petition.action, [@petition] %>”.
+<% end %>
+
diff --git a/app/views/application_mailer/_reason.text.erb b/app/views/application_mailer/_reason.text.erb
new file mode 100644
index 000000000..560d683b2
--- /dev/null
+++ b/app/views/application_mailer/_reason.text.erb
@@ -0,0 +1,12 @@
+<% if @signature.creator? %>
+You’re receiving this email because you created the petition “<%= @petition.action %>”:
+<%= polymorphic_url(@petition) %>
+<% elsif @signature.sponsor? %>
+You’re receiving this email because you supported the petition “<%= @petition.action %>”:
+<%= polymorphic_url(@petition) %>
+<% else %>
+You’re receiving this email because you signed the petition “<%= @petition.action %>”:
+<%= polymorphic_url(@petition) %>
+<% end %>
+
+--
diff --git a/app/views/application_mailer/_unsubscribe.html.erb b/app/views/application_mailer/_unsubscribe.html.erb
new file mode 100644
index 000000000..0625459e8
--- /dev/null
+++ b/app/views/application_mailer/_unsubscribe.html.erb
@@ -0,0 +1,3 @@
+
+
+<%= link_to "Unsubscribe", [:unsubscribe, @signature, token: @signature.unsubscribe_token] %> from emails about this petition.
diff --git a/app/views/application_mailer/_unsubscribe.text.erb b/app/views/application_mailer/_unsubscribe.text.erb
new file mode 100644
index 000000000..3c2e2be34
--- /dev/null
+++ b/app/views/application_mailer/_unsubscribe.text.erb
@@ -0,0 +1,4 @@
+--
+
+Unsubscribe from emails about this petition:
+<%= polymorphic_url([:unsubscribe, @signature], token: @signature.unsubscribe_token) %>
diff --git a/app/views/archived/petition_mailer/email_creator.html.erb b/app/views/archived/petition_mailer/email_creator.html.erb
index 45305269f..12f0a73b8 100644
--- a/app/views/archived/petition_mailer/email_creator.html.erb
+++ b/app/views/archived/petition_mailer/email_creator.html.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
-
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
You recently created the petition “<%= @petition.action %>”:
@@ -9,10 +6,5 @@
<%= markdown_to_html(@email.body) %>
-
Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
-
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/archived/petition_mailer/email_creator.text.erb b/app/views/archived/petition_mailer/email_creator.text.erb
index 5a42e8b49..8a8edb22a 100644
--- a/app/views/archived/petition_mailer/email_creator.text.erb
+++ b/app/views/archived/petition_mailer/email_creator.text.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
---
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
You recently created the petition “<%= @petition.action %>”:
@@ -9,10 +6,5 @@ You recently created the petition “<%= @petition.action %>”:
<%= markdown_to_text(@email.body) %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
---
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/archived/petition_mailer/email_signer.html.erb b/app/views/archived/petition_mailer/email_signer.html.erb
index cad76c179..9b045ec49 100644
--- a/app/views/archived/petition_mailer/email_signer.html.erb
+++ b/app/views/archived/petition_mailer/email_signer.html.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
-
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
You recently signed the petition “<%= @petition.action %>”:
@@ -9,10 +6,5 @@
<%= markdown_to_html(@email.body) %>
-
Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
-
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/archived/petition_mailer/email_signer.text.erb b/app/views/archived/petition_mailer/email_signer.text.erb
index 55cec1a15..2023e2dc8 100644
--- a/app/views/archived/petition_mailer/email_signer.text.erb
+++ b/app/views/archived/petition_mailer/email_signer.text.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
---
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
You recently signed the petition “<%= @petition.action %>”:
@@ -9,10 +6,5 @@ You recently signed the petition “<%= @petition.action %>”:
<%= markdown_to_text(@email.body) %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
---
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/archived/petition_mailer/mailshot_for_creator.html.erb b/app/views/archived/petition_mailer/mailshot_for_creator.html.erb
index 17f4e3b97..4dc2dd09e 100644
--- a/app/views/archived/petition_mailer/mailshot_for_creator.html.erb
+++ b/app/views/archived/petition_mailer/mailshot_for_creator.html.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
-
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
You recently created the petition “<%= @petition.action %>”:
@@ -9,10 +6,5 @@
<%= markdown_to_html(@mailshot.body) %>
-
Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
-
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/archived/petition_mailer/mailshot_for_creator.text.erb b/app/views/archived/petition_mailer/mailshot_for_creator.text.erb
index c5d87f897..811c61640 100644
--- a/app/views/archived/petition_mailer/mailshot_for_creator.text.erb
+++ b/app/views/archived/petition_mailer/mailshot_for_creator.text.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
---
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
You recently created the petition “<%= @petition.action %>”:
@@ -9,10 +6,5 @@ You recently created the petition “<%= @petition.action %>”:
<%= markdown_to_text(@mailshot.body) %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
---
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/archived/petition_mailer/mailshot_for_signer.html.erb b/app/views/archived/petition_mailer/mailshot_for_signer.html.erb
index 17849b2f6..788fa7c65 100644
--- a/app/views/archived/petition_mailer/mailshot_for_signer.html.erb
+++ b/app/views/archived/petition_mailer/mailshot_for_signer.html.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
-
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
You recently signed the petition “<%= @petition.action %>”:
@@ -9,10 +6,5 @@
<%= markdown_to_html(@mailshot.body) %>
-
Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
-
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/archived/petition_mailer/mailshot_for_signer.text.erb b/app/views/archived/petition_mailer/mailshot_for_signer.text.erb
index 73e895b2f..2779db731 100644
--- a/app/views/archived/petition_mailer/mailshot_for_signer.text.erb
+++ b/app/views/archived/petition_mailer/mailshot_for_signer.text.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
---
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
You recently signed the petition “<%= @petition.action %>”:
@@ -9,10 +6,5 @@ You recently signed the petition “<%= @petition.action %>”:
<%= markdown_to_text(@mailshot.body) %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
---
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/archived/petition_mailer/notify_creator_of_debate_outcome.html.erb b/app/views/archived/petition_mailer/notify_creator_of_debate_outcome.html.erb
index 233e33819..c6004680d 100644
--- a/app/views/archived/petition_mailer/notify_creator_of_debate_outcome.html.erb
+++ b/app/views/archived/petition_mailer/notify_creator_of_debate_outcome.html.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
-
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
<% if @debate_outcome.debated? %>
@@ -44,10 +41,5 @@
Find out more about the Petitions Committee: <%= link_to nil, help_url(anchor: "petitions-committee") %>
<% end %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
-
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/archived/petition_mailer/notify_creator_of_debate_outcome.text.erb b/app/views/archived/petition_mailer/notify_creator_of_debate_outcome.text.erb
index 0ab857310..baa434523 100644
--- a/app/views/archived/petition_mailer/notify_creator_of_debate_outcome.text.erb
+++ b/app/views/archived/petition_mailer/notify_creator_of_debate_outcome.text.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
---
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
<% if @debate_outcome.debated? %>
@@ -45,10 +42,5 @@ The petition: <%= archived_petition_url(@petition) %>
Find out more about the Petitions Committee: <%= help_url(anchor: "petitions-committee") %>
<% end %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
---
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/archived/petition_mailer/notify_creator_of_debate_scheduled.html.erb b/app/views/archived/petition_mailer/notify_creator_of_debate_scheduled.html.erb
index 9b916cd8a..faa357842 100644
--- a/app/views/archived/petition_mailer/notify_creator_of_debate_scheduled.html.erb
+++ b/app/views/archived/petition_mailer/notify_creator_of_debate_scheduled.html.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
-
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
Parliament is going to debate your petition – “<%= @petition.action %>”.
@@ -12,10 +9,5 @@
Once the debate has happened, we’ll email you a video and transcript.
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
-
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/archived/petition_mailer/notify_creator_of_debate_scheduled.text.erb b/app/views/archived/petition_mailer/notify_creator_of_debate_scheduled.text.erb
index ad5d1f1ad..d5bd2867e 100644
--- a/app/views/archived/petition_mailer/notify_creator_of_debate_scheduled.text.erb
+++ b/app/views/archived/petition_mailer/notify_creator_of_debate_scheduled.text.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
---
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
Parliament is going to debate your petition – “<%= @petition.action %>”.
@@ -12,10 +9,5 @@ The debate is scheduled for <%= short_date_format(@petition.scheduled_debate_dat
Once the debate has happened, we’ll email you a video and transcript.
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
---
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/archived/petition_mailer/notify_creator_of_threshold_response.html.erb b/app/views/archived/petition_mailer/notify_creator_of_threshold_response.html.erb
index 1a4073605..fdf8e2f02 100644
--- a/app/views/archived/petition_mailer/notify_creator_of_threshold_response.html.erb
+++ b/app/views/archived/petition_mailer/notify_creator_of_threshold_response.html.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
-
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
The Government has responded to your petition – “<%= link_to @petition.action, archived_petition_url(@petition) %>”.
@@ -24,10 +21,5 @@
The Committee is made up of 11 MPs, from political parties in government and in opposition. It is entirely independent of the Government. Find out more about the Committee: <%= link_to nil, help_url(anchor: 'petitions-committee') %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
-
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/archived/petition_mailer/notify_creator_of_threshold_response.text.erb b/app/views/archived/petition_mailer/notify_creator_of_threshold_response.text.erb
index 33cffe551..92a71790c 100644
--- a/app/views/archived/petition_mailer/notify_creator_of_threshold_response.text.erb
+++ b/app/views/archived/petition_mailer/notify_creator_of_threshold_response.text.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
---
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
The Government has responded to your petition – “<%= @petition.action %>”.
@@ -24,10 +21,5 @@ This petition has over <%= Site.formatted_threshold_for_debate %> signatures. Th
The Committee is made up of 11 MPs, from political parties in government and in opposition. It is entirely independent of the Government. Find out more about the Committee: <%= help_url(anchor: 'petitions-committee') %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
---
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/archived/petition_mailer/notify_signer_of_debate_outcome.html.erb b/app/views/archived/petition_mailer/notify_signer_of_debate_outcome.html.erb
index 6b4359ef2..10024ce92 100644
--- a/app/views/archived/petition_mailer/notify_signer_of_debate_outcome.html.erb
+++ b/app/views/archived/petition_mailer/notify_signer_of_debate_outcome.html.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
-
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
<% if @debate_outcome.debated? %>
@@ -43,10 +40,5 @@
Find out more about the Petitions Committee: <%= link_to nil, help_url(anchor: "petitions-committee") %>
<% end %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
-
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/archived/petition_mailer/notify_signer_of_debate_outcome.text.erb b/app/views/archived/petition_mailer/notify_signer_of_debate_outcome.text.erb
index ae039ce5a..a7dacf629 100644
--- a/app/views/archived/petition_mailer/notify_signer_of_debate_outcome.text.erb
+++ b/app/views/archived/petition_mailer/notify_signer_of_debate_outcome.text.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
---
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
<% if @debate_outcome.debated? %>
@@ -44,10 +41,5 @@ The petition: <%= archived_petition_url(@petition) %>
Find out more about the Petitions Committee: <%= help_url(anchor: "petitions-committee") %>
<% end %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
---
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/archived/petition_mailer/notify_signer_of_debate_scheduled.html.erb b/app/views/archived/petition_mailer/notify_signer_of_debate_scheduled.html.erb
index 03105bafe..1a1593171 100644
--- a/app/views/archived/petition_mailer/notify_signer_of_debate_scheduled.html.erb
+++ b/app/views/archived/petition_mailer/notify_signer_of_debate_scheduled.html.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
-
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
Parliament is going to debate the petition you signed – “<%= @petition.action %>”.
@@ -12,10 +9,5 @@
Once the debate has happened, we’ll email you a video and transcript.
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
-
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/archived/petition_mailer/notify_signer_of_debate_scheduled.text.erb b/app/views/archived/petition_mailer/notify_signer_of_debate_scheduled.text.erb
index 7c288eb62..eda043605 100644
--- a/app/views/archived/petition_mailer/notify_signer_of_debate_scheduled.text.erb
+++ b/app/views/archived/petition_mailer/notify_signer_of_debate_scheduled.text.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
---
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
Parliament is going to debate the petition you signed – “<%= @petition.action %>”.
@@ -12,10 +9,5 @@ The debate is scheduled for <%= short_date_format(@petition.scheduled_debate_dat
Once the debate has happened, we’ll email you a video and transcript.
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
---
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/archived/petition_mailer/notify_signer_of_threshold_response.html.erb b/app/views/archived/petition_mailer/notify_signer_of_threshold_response.html.erb
index a0547fc48..57957c1f7 100644
--- a/app/views/archived/petition_mailer/notify_signer_of_threshold_response.html.erb
+++ b/app/views/archived/petition_mailer/notify_signer_of_threshold_response.html.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
-
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
The Government has responded to the petition you signed – “<%= link_to @petition.action, archived_petition_url(@petition) %>”.
@@ -24,10 +21,5 @@
The Committee is made up of 11 MPs, from political parties in government and in opposition. It is entirely independent of the Government. Find out more about the Committee: <%= link_to nil, help_url(anchor: 'petitions-committee') %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
-
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/archived/petition_mailer/notify_signer_of_threshold_response.text.erb b/app/views/archived/petition_mailer/notify_signer_of_threshold_response.text.erb
index cab336660..65b0f2c39 100644
--- a/app/views/archived/petition_mailer/notify_signer_of_threshold_response.text.erb
+++ b/app/views/archived/petition_mailer/notify_signer_of_threshold_response.text.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
---
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
The Government has responded to the petition you signed – “<%= @petition.action %>”.
@@ -24,10 +21,5 @@ This petition has over <%= @parliament.formatted_threshold_for_debate %> signatu
The Committee is made up of 11 MPs, from political parties in government and in opposition. It is entirely independent of the Government. Find out more about the Committee: <%= help_url(anchor: 'petitions-committee') %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
---
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_archived_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/petition_mailer/email_confirmation_for_signer.html.erb b/app/views/petition_mailer/email_confirmation_for_signer.html.erb
index 5d89b989f..210735c86 100644
--- a/app/views/petition_mailer/email_confirmation_for_signer.html.erb
+++ b/app/views/petition_mailer/email_confirmation_for_signer.html.erb
@@ -2,6 +2,4 @@
<%= link_to nil, verify_signature_url(@signature, token: @signature.perishable_token) %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
+<%= render "footer" %>
diff --git a/app/views/petition_mailer/email_confirmation_for_signer.text.erb b/app/views/petition_mailer/email_confirmation_for_signer.text.erb
index e33c4755e..d5f6d960f 100644
--- a/app/views/petition_mailer/email_confirmation_for_signer.text.erb
+++ b/app/views/petition_mailer/email_confirmation_for_signer.text.erb
@@ -2,6 +2,4 @@ Click this link to sign the petition "<%= @petition.action %>"
<%= verify_signature_url(@signature, token: @signature.perishable_token) %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
+<%= render "footer" %>
diff --git a/app/views/petition_mailer/email_creator.html.erb b/app/views/petition_mailer/email_creator.html.erb
index 7cdef4e03..ba26692aa 100644
--- a/app/views/petition_mailer/email_creator.html.erb
+++ b/app/views/petition_mailer/email_creator.html.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
-
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
You recently created the petition “<%= @petition.action %>”:
@@ -9,10 +6,5 @@
<%= markdown_to_html(@email.body) %>
-
Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
-
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/petition_mailer/email_creator.text.erb b/app/views/petition_mailer/email_creator.text.erb
index b33be16cb..369381f18 100644
--- a/app/views/petition_mailer/email_creator.text.erb
+++ b/app/views/petition_mailer/email_creator.text.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
---
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
You recently created the petition “<%= @petition.action %>”:
@@ -9,10 +6,5 @@ You recently created the petition “<%= @petition.action %>”:
<%= markdown_to_text(@email.body) %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
---
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/petition_mailer/email_duplicate_signatures.html.erb b/app/views/petition_mailer/email_duplicate_signatures.html.erb
index f1d087b34..405fcc83d 100644
--- a/app/views/petition_mailer/email_duplicate_signatures.html.erb
+++ b/app/views/petition_mailer/email_duplicate_signatures.html.erb
@@ -3,6 +3,4 @@
View the petition “<%= @petition.action %>” at:
<%= link_to nil, petition_url(@petition) %>
-
Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
+<%= render "footer" %>
diff --git a/app/views/petition_mailer/email_duplicate_signatures.text.erb b/app/views/petition_mailer/email_duplicate_signatures.text.erb
index 9dee6cab8..998a6e25f 100644
--- a/app/views/petition_mailer/email_duplicate_signatures.text.erb
+++ b/app/views/petition_mailer/email_duplicate_signatures.text.erb
@@ -3,6 +3,4 @@ You're receiving this email because your email has been used to sign the petitio
View the petition “<%= @petition.action %>” at:
<%= petition_url(@petition) %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
+<%= render "footer" %>
diff --git a/app/views/petition_mailer/email_signer.html.erb b/app/views/petition_mailer/email_signer.html.erb
index 8cd968bbd..dec97d201 100644
--- a/app/views/petition_mailer/email_signer.html.erb
+++ b/app/views/petition_mailer/email_signer.html.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
-
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
You recently signed the petition “<%= @petition.action %>”:
@@ -9,10 +6,5 @@
<%= markdown_to_html(@email.body) %>
-
Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
-
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/petition_mailer/email_signer.text.erb b/app/views/petition_mailer/email_signer.text.erb
index c8404d0f7..d3bb7b5f2 100644
--- a/app/views/petition_mailer/email_signer.text.erb
+++ b/app/views/petition_mailer/email_signer.text.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
---
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
You recently signed the petition “<%= @petition.action %>”:
@@ -9,10 +6,5 @@ You recently signed the petition “<%= @petition.action %>”:
<%= markdown_to_text(@email.body) %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
---
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/petition_mailer/gather_sponsors_for_petition.html.erb b/app/views/petition_mailer/gather_sponsors_for_petition.html.erb
index f9b1d5a4a..a4f0cf524 100644
--- a/app/views/petition_mailer/gather_sponsors_for_petition.html.erb
+++ b/app/views/petition_mailer/gather_sponsors_for_petition.html.erb
@@ -18,9 +18,7 @@
Once your petition has <%= Site.maximum_number_of_signatures %> signatures it won’t be able to add more until it’s been checked by the petitions team. So, please wait until it’s been checked and published before sharing it more widely.
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
+<%= render "footer" %>
diff --git a/app/views/petition_mailer/gather_sponsors_for_petition.text.erb b/app/views/petition_mailer/gather_sponsors_for_petition.text.erb
index 3fff22019..96d29db36 100644
--- a/app/views/petition_mailer/gather_sponsors_for_petition.text.erb
+++ b/app/views/petition_mailer/gather_sponsors_for_petition.text.erb
@@ -18,9 +18,7 @@ Once you’ve gained the required number of supporters, we’ll check your petit
Once your petition has <%= Site.maximum_number_of_signatures %> signatures it won’t be able to add more until it’s been checked by the petitions team. So, please wait until it’s been checked and published before sharing it more widely.
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
+<%= render "footer" %>
--
diff --git a/app/views/petition_mailer/mailshot_for_creator.html.erb b/app/views/petition_mailer/mailshot_for_creator.html.erb
index 817a6ad9b..6cca0ab76 100644
--- a/app/views/petition_mailer/mailshot_for_creator.html.erb
+++ b/app/views/petition_mailer/mailshot_for_creator.html.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
-
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
You recently created the petition “<%= @petition.action %>”:
@@ -9,10 +6,5 @@
<%= markdown_to_html(@mailshot.body) %>
-
Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
-
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/petition_mailer/mailshot_for_creator.text.erb b/app/views/petition_mailer/mailshot_for_creator.text.erb
index b1e488885..2adf804da 100644
--- a/app/views/petition_mailer/mailshot_for_creator.text.erb
+++ b/app/views/petition_mailer/mailshot_for_creator.text.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
---
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
You recently created the petition “<%= @petition.action %>”:
@@ -9,10 +6,5 @@ You recently created the petition “<%= @petition.action %>”:
<%= markdown_to_text(@mailshot.body) %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
---
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/petition_mailer/mailshot_for_signer.html.erb b/app/views/petition_mailer/mailshot_for_signer.html.erb
index 5bbbb25b2..cf2bf28a8 100644
--- a/app/views/petition_mailer/mailshot_for_signer.html.erb
+++ b/app/views/petition_mailer/mailshot_for_signer.html.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
-
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
You recently signed the petition “<%= @petition.action %>”:
@@ -9,10 +6,5 @@
<%= markdown_to_html(@mailshot.body) %>
-
Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
-
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/petition_mailer/mailshot_for_signer.text.erb b/app/views/petition_mailer/mailshot_for_signer.text.erb
index b05fd6e0f..11d38ab63 100644
--- a/app/views/petition_mailer/mailshot_for_signer.text.erb
+++ b/app/views/petition_mailer/mailshot_for_signer.text.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
---
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
You recently signed the petition “<%= @petition.action %>”:
@@ -9,10 +6,5 @@ You recently signed the petition “<%= @petition.action %>”:
<%= markdown_to_text(@mailshot.body) %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
---
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/petition_mailer/notify_creator_of_closing_date_change.html.erb b/app/views/petition_mailer/notify_creator_of_closing_date_change.html.erb
index e99d2ed05..89422e572 100644
--- a/app/views/petition_mailer/notify_creator_of_closing_date_change.html.erb
+++ b/app/views/petition_mailer/notify_creator_of_closing_date_change.html.erb
@@ -29,6 +29,4 @@
<% end %>
Ahead of the General Election on <%= @election_date %>, make sure you’re registered to vote. You can check whether you’re eligible to vote and find out how to register at: https://www.gov.uk/register-to-vote. The deadline to register to vote is <%= @registration_deadline %>.
-Many thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
+<%= render "footer", closing: "Many thanks" %>
diff --git a/app/views/petition_mailer/notify_creator_of_closing_date_change.text.erb b/app/views/petition_mailer/notify_creator_of_closing_date_change.text.erb
index c4d04cf53..f9c433539 100644
--- a/app/views/petition_mailer/notify_creator_of_closing_date_change.text.erb
+++ b/app/views/petition_mailer/notify_creator_of_closing_date_change.text.erb
@@ -29,6 +29,4 @@ You can find out more about what the General Election means for your petitions o
<% end %>
Ahead of the General Election on <%= @election_date %>, make sure you’re registered to vote. You can check whether you’re eligible to vote and find out how to register at: https://www.gov.uk/register-to-vote. The deadline to register to vote is <%= @registration_deadline %>.
-Many thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
+<%= render "footer", closing: "Many thanks" %>
diff --git a/app/views/petition_mailer/notify_creator_of_debate_outcome.html.erb b/app/views/petition_mailer/notify_creator_of_debate_outcome.html.erb
index b3199df42..a4848c59b 100644
--- a/app/views/petition_mailer/notify_creator_of_debate_outcome.html.erb
+++ b/app/views/petition_mailer/notify_creator_of_debate_outcome.html.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
-
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
<% if @debate_outcome.debated? %>
@@ -51,10 +48,5 @@
Find out more about the Petitions Committee: <%= link_to nil, help_url(anchor: "petitions-committee") %>
<% end %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
-
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/petition_mailer/notify_creator_of_debate_outcome.text.erb b/app/views/petition_mailer/notify_creator_of_debate_outcome.text.erb
index 7654f3561..1e70cebae 100644
--- a/app/views/petition_mailer/notify_creator_of_debate_outcome.text.erb
+++ b/app/views/petition_mailer/notify_creator_of_debate_outcome.text.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
---
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
<% if @debate_outcome.debated? %>
@@ -45,10 +42,5 @@ The petition: <%= petition_url(@petition) %>
Find out more about the Petitions Committee: <%= help_url(anchor: "petitions-committee") %>
<% end %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
---
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/petition_mailer/notify_creator_of_debate_scheduled.html.erb b/app/views/petition_mailer/notify_creator_of_debate_scheduled.html.erb
index f6da9f942..ef926c9ed 100644
--- a/app/views/petition_mailer/notify_creator_of_debate_scheduled.html.erb
+++ b/app/views/petition_mailer/notify_creator_of_debate_scheduled.html.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
-
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
Parliament is going to debate your petition – “<%= @petition.action %>”.
@@ -12,10 +9,5 @@
Once the debate has happened, we’ll email you a video and transcript.
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
-
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/petition_mailer/notify_creator_of_debate_scheduled.text.erb b/app/views/petition_mailer/notify_creator_of_debate_scheduled.text.erb
index d20e64230..3a5662c89 100644
--- a/app/views/petition_mailer/notify_creator_of_debate_scheduled.text.erb
+++ b/app/views/petition_mailer/notify_creator_of_debate_scheduled.text.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
---
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
Parliament is going to debate your petition – “<%= @petition.action %>”.
@@ -12,10 +9,5 @@ The debate is scheduled for <%= short_date_format(@petition.scheduled_debate_dat
Once the debate has happened, we’ll email you a video and transcript.
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
---
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/petition_mailer/notify_creator_of_sponsored_petition_being_stopped.html.erb b/app/views/petition_mailer/notify_creator_of_sponsored_petition_being_stopped.html.erb
index a71ec5422..21dc7333e 100644
--- a/app/views/petition_mailer/notify_creator_of_sponsored_petition_being_stopped.html.erb
+++ b/app/views/petition_mailer/notify_creator_of_sponsored_petition_being_stopped.html.erb
@@ -12,6 +12,4 @@
You can find out more about what the General Election means for your petitions on our website: <%= link_to(nil, Parliament.dissolution_faq_url) %>
<% end %>
-Many thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
+<%= render "footer", closing: "Many thanks" %>
diff --git a/app/views/petition_mailer/notify_creator_of_sponsored_petition_being_stopped.text.erb b/app/views/petition_mailer/notify_creator_of_sponsored_petition_being_stopped.text.erb
index a1ba3e8c2..7c21af6ce 100644
--- a/app/views/petition_mailer/notify_creator_of_sponsored_petition_being_stopped.text.erb
+++ b/app/views/petition_mailer/notify_creator_of_sponsored_petition_being_stopped.text.erb
@@ -12,6 +12,4 @@ The petitions site will reopen when a new Petitions Committee is appointed, but
You can find out more about what the General Election means for your petitions on our website: <%= Parliament.dissolution_faq_url %>
<% end %>
-Many thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
+<%= render "footer", closing: "Many thanks" %>
diff --git a/app/views/petition_mailer/notify_creator_of_threshold_response.html.erb b/app/views/petition_mailer/notify_creator_of_threshold_response.html.erb
index 339ac4ad7..5a5da96e9 100644
--- a/app/views/petition_mailer/notify_creator_of_threshold_response.html.erb
+++ b/app/views/petition_mailer/notify_creator_of_threshold_response.html.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
-
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
The Government has responded to your petition – “<%= link_to @petition.action, petition_url(@petition) %>”.
@@ -24,10 +21,5 @@
The Committee is made up of 11 MPs, from political parties in government and in opposition. It is entirely independent of the Government. Find out more about the Committee: <%= link_to nil, help_url(anchor: 'petitions-committee') %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
-
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/petition_mailer/notify_creator_of_threshold_response.text.erb b/app/views/petition_mailer/notify_creator_of_threshold_response.text.erb
index cbe227118..4deb5e338 100644
--- a/app/views/petition_mailer/notify_creator_of_threshold_response.text.erb
+++ b/app/views/petition_mailer/notify_creator_of_threshold_response.text.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
---
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
The Government has responded to your petition – “<%= @petition.action %>”.
@@ -24,10 +21,5 @@ This petition has over <%= Site.formatted_threshold_for_debate %> signatures. Th
The Committee is made up of 11 MPs, from political parties in government and in opposition. It is entirely independent of the Government. Find out more about the Committee: <%= help_url(anchor: 'petitions-committee') %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
---
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/petition_mailer/notify_creator_of_validated_petition_being_stopped.html.erb b/app/views/petition_mailer/notify_creator_of_validated_petition_being_stopped.html.erb
index a95c02eb2..206f0d389 100644
--- a/app/views/petition_mailer/notify_creator_of_validated_petition_being_stopped.html.erb
+++ b/app/views/petition_mailer/notify_creator_of_validated_petition_being_stopped.html.erb
@@ -12,6 +12,4 @@
You can find out more about what the General Election means for your petitions on our website: <%= link_to(nil, Parliament.dissolution_faq_url) %>
<% end %>
-Many thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
+<%= render "footer", closing: "Many thanks" %>
diff --git a/app/views/petition_mailer/notify_creator_of_validated_petition_being_stopped.text.erb b/app/views/petition_mailer/notify_creator_of_validated_petition_being_stopped.text.erb
index 898acb8b4..6bec8d2d4 100644
--- a/app/views/petition_mailer/notify_creator_of_validated_petition_being_stopped.text.erb
+++ b/app/views/petition_mailer/notify_creator_of_validated_petition_being_stopped.text.erb
@@ -12,6 +12,4 @@ The petitions site will reopen when a new Petitions Committee is appointed, but
You can find out more about what the General Election means for your petitions on our website: <%= Parliament.dissolution_faq_url %>
<% end %>
-Many thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
+<%= render "footer", closing: "Many thanks" %>
diff --git a/app/views/petition_mailer/notify_creator_that_moderation_is_delayed.html.erb b/app/views/petition_mailer/notify_creator_that_moderation_is_delayed.html.erb
index 29f8c1e67..4270d159c 100644
--- a/app/views/petition_mailer/notify_creator_that_moderation_is_delayed.html.erb
+++ b/app/views/petition_mailer/notify_creator_that_moderation_is_delayed.html.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
-
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
You recently created the petition “<%= @petition.action %>”:
@@ -9,10 +6,5 @@
<%= auto_link(simple_format(h(@body))) %>
-
Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
-
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/petition_mailer/notify_creator_that_moderation_is_delayed.text.erb b/app/views/petition_mailer/notify_creator_that_moderation_is_delayed.text.erb
index b1721b35f..a7d24fe71 100644
--- a/app/views/petition_mailer/notify_creator_that_moderation_is_delayed.text.erb
+++ b/app/views/petition_mailer/notify_creator_that_moderation_is_delayed.text.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
---
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
You recently created the petition “<%= @petition.action %>”:
@@ -9,10 +6,5 @@ You recently created the petition “<%= @petition.action %>”:
<%= @body %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
---
-You’re receiving this email because you created this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/petition_mailer/notify_creator_that_petition_is_published.html.erb b/app/views/petition_mailer/notify_creator_that_petition_is_published.html.erb
index 5c60b4ca0..14dbbfa26 100644
--- a/app/views/petition_mailer/notify_creator_that_petition_is_published.html.erb
+++ b/app/views/petition_mailer/notify_creator_that_petition_is_published.html.erb
@@ -5,6 +5,4 @@
Click this link to see your petition and start sharing it:
<%= link_to nil, petition_url(@petition) %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
+<%= render "footer" %>
diff --git a/app/views/petition_mailer/notify_creator_that_petition_is_published.text.erb b/app/views/petition_mailer/notify_creator_that_petition_is_published.text.erb
index 1a57c2d80..6dc6d0349 100644
--- a/app/views/petition_mailer/notify_creator_that_petition_is_published.text.erb
+++ b/app/views/petition_mailer/notify_creator_that_petition_is_published.text.erb
@@ -5,6 +5,4 @@ We published the petition you created – “<%= @petition.action %>”.
Click this link to see your petition and start sharing it:
<%= petition_url(@petition) %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
+<%= render "footer" %>
diff --git a/app/views/petition_mailer/notify_creator_that_petition_was_rejected.html.erb b/app/views/petition_mailer/notify_creator_that_petition_was_rejected.html.erb
index 84635f489..ddd72a93b 100644
--- a/app/views/petition_mailer/notify_creator_that_petition_was_rejected.html.erb
+++ b/app/views/petition_mailer/notify_creator_that_petition_was_rejected.html.erb
@@ -19,6 +19,4 @@
If you want to try again, click here to start a petition:
<%= link_to nil, check_petitions_url %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
+<%= render "footer" %>
diff --git a/app/views/petition_mailer/notify_creator_that_petition_was_rejected.text.erb b/app/views/petition_mailer/notify_creator_that_petition_was_rejected.text.erb
index 83c1fe967..436fd465b 100644
--- a/app/views/petition_mailer/notify_creator_that_petition_was_rejected.text.erb
+++ b/app/views/petition_mailer/notify_creator_that_petition_was_rejected.text.erb
@@ -19,6 +19,4 @@ We only reject petitions that don’t meet the petition standards:
If you want to try again, click here to start a petition:
<%= check_petitions_url %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
+<%= render "footer" %>
diff --git a/app/views/petition_mailer/notify_signer_of_closing_date_change.html.erb b/app/views/petition_mailer/notify_signer_of_closing_date_change.html.erb
index 6f4870269..a7a4f9eba 100644
--- a/app/views/petition_mailer/notify_signer_of_closing_date_change.html.erb
+++ b/app/views/petition_mailer/notify_signer_of_closing_date_change.html.erb
@@ -29,6 +29,4 @@
<% end %>
Ahead of the General Election on <%= @election_date %>, make sure you’re registered to vote. You can check whether you’re eligible to vote and find out how to register at: https://www.gov.uk/register-to-vote. The deadline to register to vote is <%= @registration_deadline %>.
-Many thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
+<%= render "footer", closing: "Many thanks" %>
diff --git a/app/views/petition_mailer/notify_signer_of_closing_date_change.text.erb b/app/views/petition_mailer/notify_signer_of_closing_date_change.text.erb
index ff7dde97d..fb1bc5865 100644
--- a/app/views/petition_mailer/notify_signer_of_closing_date_change.text.erb
+++ b/app/views/petition_mailer/notify_signer_of_closing_date_change.text.erb
@@ -29,6 +29,4 @@ You can find out more about what the General Election means for your petitions o
<% end %>
Ahead of the General Election on <%= @election_date %>, make sure you’re registered to vote. You can check whether you’re eligible to vote and find out how to register at: https://www.gov.uk/register-to-vote. The deadline to register to vote is <%= @registration_deadline %>.
-Many thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
+<%= render "footer", closing: "Many thanks" %>
diff --git a/app/views/petition_mailer/notify_signer_of_debate_outcome.html.erb b/app/views/petition_mailer/notify_signer_of_debate_outcome.html.erb
index c66ebc5ed..10b4192ac 100644
--- a/app/views/petition_mailer/notify_signer_of_debate_outcome.html.erb
+++ b/app/views/petition_mailer/notify_signer_of_debate_outcome.html.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
-
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
<% if @debate_outcome.debated? %>
@@ -43,10 +40,5 @@
Find out more about the Petitions Committee: <%= link_to nil, help_url(anchor: "petitions-committee") %>
<% end %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
-
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/petition_mailer/notify_signer_of_debate_outcome.text.erb b/app/views/petition_mailer/notify_signer_of_debate_outcome.text.erb
index afeeba521..a34f979bb 100644
--- a/app/views/petition_mailer/notify_signer_of_debate_outcome.text.erb
+++ b/app/views/petition_mailer/notify_signer_of_debate_outcome.text.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
---
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
<% if @debate_outcome.debated? %>
@@ -45,10 +42,5 @@ The petition: <%= petition_url(@petition) %>
Find out more about the Petitions Committee: <%= help_url(anchor: "petitions-committee") %>
<% end %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
---
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/petition_mailer/notify_signer_of_debate_scheduled.html.erb b/app/views/petition_mailer/notify_signer_of_debate_scheduled.html.erb
index 7cbcc3e02..d2932f293 100644
--- a/app/views/petition_mailer/notify_signer_of_debate_scheduled.html.erb
+++ b/app/views/petition_mailer/notify_signer_of_debate_scheduled.html.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
-
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
Parliament is going to debate the petition you signed – “<%= @petition.action %>”.
@@ -12,10 +9,5 @@
Once the debate has happened, we’ll email you a video and transcript.
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
-
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/petition_mailer/notify_signer_of_debate_scheduled.text.erb b/app/views/petition_mailer/notify_signer_of_debate_scheduled.text.erb
index 051443e97..9f9ddc099 100644
--- a/app/views/petition_mailer/notify_signer_of_debate_scheduled.text.erb
+++ b/app/views/petition_mailer/notify_signer_of_debate_scheduled.text.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
---
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
Parliament is going to debate the petition you signed – “<%= @petition.action %>”.
@@ -12,10 +9,5 @@ The debate is scheduled for <%= short_date_format(@petition.scheduled_debate_dat
Once the debate has happened, we’ll email you a video and transcript.
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
---
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/petition_mailer/notify_signer_of_threshold_response.html.erb b/app/views/petition_mailer/notify_signer_of_threshold_response.html.erb
index 0402231fa..b361f4723 100644
--- a/app/views/petition_mailer/notify_signer_of_threshold_response.html.erb
+++ b/app/views/petition_mailer/notify_signer_of_threshold_response.html.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
-
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
The Government has responded to the petition you signed – “<%= link_to @petition.action, petition_url(@petition) %>”.
@@ -24,10 +21,5 @@
The Committee is made up of 11 MPs, from political parties in government and in opposition. It is entirely independent of the Government. Find out more about the Committee: <%= link_to nil, help_url(anchor: 'petitions-committee') %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
-
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= link_to nil, unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/petition_mailer/notify_signer_of_threshold_response.text.erb b/app/views/petition_mailer/notify_signer_of_threshold_response.text.erb
index 1ad41f706..fa32e31e7 100644
--- a/app/views/petition_mailer/notify_signer_of_threshold_response.text.erb
+++ b/app/views/petition_mailer/notify_signer_of_threshold_response.text.erb
@@ -1,7 +1,4 @@
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
---
-
+<%= render "reason" %>
Dear <%= @signature.name %>,
The Government has responded to the petition you signed – “<%= @petition.action %>”.
@@ -24,10 +21,5 @@ This petition has over <%= Site.formatted_threshold_for_debate %> signatures. Th
The Committee is made up of 11 MPs, from political parties in government and in opposition. It is entirely independent of the Government. Find out more about the Committee: <%= help_url(anchor: 'petitions-committee') %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
-
---
-You’re receiving this email because you signed this petition: “<%= @petition.action %>”.
-To unsubscribe from getting emails about this petition: <%= unsubscribe_signature_url(@signature, token: @signature.unsubscribe_token) %>
+<%= render "footer" %>
+<%= render "unsubscribe" %>
diff --git a/app/views/petition_mailer/notify_sponsor_that_petition_is_published.html.erb b/app/views/petition_mailer/notify_sponsor_that_petition_is_published.html.erb
index b1131ab7a..73ec3ce86 100644
--- a/app/views/petition_mailer/notify_sponsor_that_petition_is_published.html.erb
+++ b/app/views/petition_mailer/notify_sponsor_that_petition_is_published.html.erb
@@ -5,6 +5,4 @@
Click this link to see the petition and start sharing it:
<%= link_to nil, petition_url(@petition) %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
+<%= render "footer" %>
diff --git a/app/views/petition_mailer/notify_sponsor_that_petition_is_published.text.erb b/app/views/petition_mailer/notify_sponsor_that_petition_is_published.text.erb
index dabc51393..0266dc453 100644
--- a/app/views/petition_mailer/notify_sponsor_that_petition_is_published.text.erb
+++ b/app/views/petition_mailer/notify_sponsor_that_petition_is_published.text.erb
@@ -5,6 +5,4 @@ We published the petition you supported – “<%= @petition.action %>”.
Click this link to see the petition and start sharing it:
<%= petition_url(@petition) %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
+<%= render "footer" %>
diff --git a/app/views/petition_mailer/notify_sponsor_that_petition_was_rejected.html.erb b/app/views/petition_mailer/notify_sponsor_that_petition_was_rejected.html.erb
index 00fc879e4..c128112c1 100644
--- a/app/views/petition_mailer/notify_sponsor_that_petition_was_rejected.html.erb
+++ b/app/views/petition_mailer/notify_sponsor_that_petition_was_rejected.html.erb
@@ -16,6 +16,4 @@
We only reject petitions that don’t meet the petition standards:
<%= link_to nil, help_url(anchor: 'standards') %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
+<%= render "footer" %>
diff --git a/app/views/petition_mailer/notify_sponsor_that_petition_was_rejected.text.erb b/app/views/petition_mailer/notify_sponsor_that_petition_was_rejected.text.erb
index 602b877ab..b7f20d2bb 100644
--- a/app/views/petition_mailer/notify_sponsor_that_petition_was_rejected.text.erb
+++ b/app/views/petition_mailer/notify_sponsor_that_petition_was_rejected.text.erb
@@ -16,6 +16,4 @@ Click this link to see the rejected petition:
We only reject petitions that don’t meet the petition standards:
<%= help_url(anchor: 'standards') %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
+<%= render "footer" %>
diff --git a/app/views/petition_mailer/special_resend_of_email_confirmation_for_signer.html.erb b/app/views/petition_mailer/special_resend_of_email_confirmation_for_signer.html.erb
index ae2de7872..708d36ba7 100644
--- a/app/views/petition_mailer/special_resend_of_email_confirmation_for_signer.html.erb
+++ b/app/views/petition_mailer/special_resend_of_email_confirmation_for_signer.html.erb
@@ -6,6 +6,4 @@
<%= link_to nil, verify_signature_url(@signature, token: @signature.perishable_token) %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
+<%= render "footer" %>
diff --git a/app/views/petition_mailer/special_resend_of_email_confirmation_for_signer.text.erb b/app/views/petition_mailer/special_resend_of_email_confirmation_for_signer.text.erb
index 8cfc7f4df..5a514bb79 100644
--- a/app/views/petition_mailer/special_resend_of_email_confirmation_for_signer.text.erb
+++ b/app/views/petition_mailer/special_resend_of_email_confirmation_for_signer.text.erb
@@ -6,6 +6,4 @@ Click this link to sign the petition:
<%= verify_signature_url(@signature, token: @signature.perishable_token) %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
+<%= render "footer" %>
diff --git a/app/views/sponsor_mailer/sponsor_signed_email_below_threshold.html.erb b/app/views/sponsor_mailer/sponsor_signed_email_below_threshold.html.erb
index db8a0a4e6..78081fdab 100644
--- a/app/views/sponsor_mailer/sponsor_signed_email_below_threshold.html.erb
+++ b/app/views/sponsor_mailer/sponsor_signed_email_below_threshold.html.erb
@@ -7,6 +7,4 @@
Find out how we check petitions before we publish them:
<%= link_to nil, help_url(anchor: 'standards') %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
+<%= render "footer" %>
diff --git a/app/views/sponsor_mailer/sponsor_signed_email_below_threshold.text.erb b/app/views/sponsor_mailer/sponsor_signed_email_below_threshold.text.erb
index 41b70fa2c..9de098bc6 100644
--- a/app/views/sponsor_mailer/sponsor_signed_email_below_threshold.text.erb
+++ b/app/views/sponsor_mailer/sponsor_signed_email_below_threshold.text.erb
@@ -7,6 +7,4 @@ You have <%= pluralize(@sponsor_count, 'supporter', locale: :en) %> so far. If <
Find out how we check petitions before we publish them:
<%= help_url(anchor: 'standards') %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
+<%= render "footer" %>
diff --git a/app/views/sponsor_mailer/sponsor_signed_email_on_threshold.html.erb b/app/views/sponsor_mailer/sponsor_signed_email_on_threshold.html.erb
index b2f744930..96efca76a 100644
--- a/app/views/sponsor_mailer/sponsor_signed_email_on_threshold.html.erb
+++ b/app/views/sponsor_mailer/sponsor_signed_email_on_threshold.html.erb
@@ -19,6 +19,4 @@
Find out how we check petitions before we publish them:
<%= link_to nil, help_url(anchor: 'standards') %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
+<%= render "footer" %>
diff --git a/app/views/sponsor_mailer/sponsor_signed_email_on_threshold.text.erb b/app/views/sponsor_mailer/sponsor_signed_email_on_threshold.text.erb
index 434984b3a..0425cd461 100644
--- a/app/views/sponsor_mailer/sponsor_signed_email_on_threshold.text.erb
+++ b/app/views/sponsor_mailer/sponsor_signed_email_on_threshold.text.erb
@@ -19,6 +19,4 @@ Once your petition has <%= Site.maximum_number_of_signatures %> signatures it wo
Find out how we check petitions before we publish them:
<%= help_url(anchor: 'standards') %>
-Thanks,
-<%= t("petitions.emails.signoff_prefix") %>
-<%= t("petitions.emails.signoff_suffix") %>
+<%= render "footer" %>
From b65d5ee6f9ff7ebdfff3a2645c62b2de312bf866 Mon Sep 17 00:00:00 2001
From: Andrew White
Date: Tue, 29 Oct 2024 08:08:12 +0000
Subject: [PATCH 02/10] Update email signoff text
---
config/locales/petitions.en-GB.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/locales/petitions.en-GB.yml b/config/locales/petitions.en-GB.yml
index aca62bdad..228875159 100644
--- a/config/locales/petitions.en-GB.yml
+++ b/config/locales/petitions.en-GB.yml
@@ -208,8 +208,8 @@ en-GB:
We’ve stopped your petition early
notify_creator_of_validated_petition_being_stopped: |-
We’ve stopped your petition early
- signoff_prefix: "The Petitions team"
- signoff_suffix: "UK Government and Parliament"
+ signoff_prefix: "The Petitions Team"
+ signoff_suffix: "House of Commons"
waiting_for_in_words:
zero: "Waiting for less than a day"
From 0bb6bfb3f70830681310fd213bce57422c55e3c5 Mon Sep 17 00:00:00 2001
From: Andrew White
Date: Tue, 29 Oct 2024 09:19:54 +0000
Subject: [PATCH 03/10] Add additional mailer previews
---
app/models/petition.rb | 4 ++
.../previews/petition_mailer_preview.rb | 46 ++++++++++++++++++-
.../previews/sponsor_mailer_preview.rb | 16 +++++--
3 files changed, 62 insertions(+), 4 deletions(-)
diff --git a/app/models/petition.rb b/app/models/petition.rb
index 82de660e7..f3110f9d0 100644
--- a/app/models/petition.rb
+++ b/app/models/petition.rb
@@ -209,6 +209,10 @@ def rejected_state
where(state: REJECTED_STATE)
end
+ def validated_state
+ where(state: VALIDATED_STATE)
+ end
+
def sponsored_state
where(state: SPONSORED_STATE)
end
diff --git a/spec/mailers/previews/petition_mailer_preview.rb b/spec/mailers/previews/petition_mailer_preview.rb
index 39bcb062b..2bb48bbab 100644
--- a/spec/mailers/previews/petition_mailer_preview.rb
+++ b/spec/mailers/previews/petition_mailer_preview.rb
@@ -60,6 +60,13 @@ def notify_signer_of_threshold_response
PetitionMailer.notify_signer_of_threshold_response(petition, signature)
end
+ def notify_signer_of_debate_scheduled
+ petition = Petition.debated.last
+ signature = petition.signatures.validated.last
+
+ PetitionMailer.notify_signer_of_debate_scheduled(petition, signature)
+ end
+
def notify_creator_of_threshold_response
petition = Petition.with_response.last
signature = petition.creator
@@ -67,6 +74,13 @@ def notify_creator_of_threshold_response
PetitionMailer.notify_creator_of_threshold_response(petition, signature)
end
+ def notify_creator_of_debate_scheduled
+ petition = Petition.debated.last
+ signature = petition.creator
+
+ PetitionMailer.notify_creator_of_debate_scheduled(petition, signature)
+ end
+
def notify_creator_of_closing_date_change
petition = Petition.open_at_dissolution.first
signature = petition.creator
@@ -104,7 +118,7 @@ def debated_petition_signer_notification
def debated_petition_creator_notification
petition = Petition.debated.last
- signature = petition.signatures.validated.last
+ signature = petition.creator
PetitionMailer.notify_creator_of_debate_outcome(petition, signature)
end
@@ -127,4 +141,34 @@ def privacy_policy_update_email
privacy_notification = PrivacyNotification.last
PetitionMailer.privacy_policy_update_email(privacy_notification)
end
+
+ def notify_creator_that_petition_is_published
+ signature = Signature.creator.last
+ PetitionMailer.notify_creator_that_petition_is_published(signature)
+ end
+
+ def notify_creator_that_petition_is_rejected
+ signature = Petition.rejected_state.first.creator
+ PetitionMailer.notify_creator_that_petition_was_rejected(signature)
+ end
+
+ def notify_creator_that_petition_is_rejected_and_hidden
+ signature = Petition.hidden_state.first.creator
+ PetitionMailer.notify_creator_that_petition_was_rejected(signature)
+ end
+
+ def notify_sponsor_that_petition_is_published
+ signature = Signature.sponsors.last
+ PetitionMailer.notify_sponsor_that_petition_is_published(signature)
+ end
+
+ def notify_sponsor_that_petition_is_rejected
+ signature = Petition.rejected_state.first.sponsors.first
+ PetitionMailer.notify_sponsor_that_petition_was_rejected(signature)
+ end
+
+ def notify_sponsor_that_petition_is_rejected_and_hidden
+ signature = Petition.hidden_state.first.sponsors.first
+ PetitionMailer.notify_sponsor_that_petition_was_rejected(signature)
+ end
end
diff --git a/spec/mailers/previews/sponsor_mailer_preview.rb b/spec/mailers/previews/sponsor_mailer_preview.rb
index 2a692a643..55de58b8e 100644
--- a/spec/mailers/previews/sponsor_mailer_preview.rb
+++ b/spec/mailers/previews/sponsor_mailer_preview.rb
@@ -1,12 +1,22 @@
# Preview all emails at http://localhost:3000/rails/mailers/sponsor_mailer
class SponsorMailerPreview < ActionMailer::Preview
def petition_and_email_confirmation_for_sponsor
- SponsorMailer.petition_and_email_confirmation_for_sponsor(Signature.sponsors.last)
+ petition = Petition.validated_state.last
+ sponsor = petition.sponsors.last
+
+ SponsorMailer.petition_and_email_confirmation_for_sponsor(sponsor)
+ end
+
+ def sponsor_signed_email_below_threshold
+ petition = Petition.validated_state.last
+ sponsor = petition.sponsors.last
+
+ SponsorMailer.sponsor_signed_email_below_threshold(sponsor)
end
def sponsor_signed_email_on_threshold
- sponsor = Signature.sponsors.last
- petition = sponsor.petition
+ petition = Petition.sponsored_state.last
+ sponsor = petition.sponsors.last
SponsorMailer.sponsor_signed_email_on_threshold(sponsor)
end
From d823b6a8a10c0188d602fe619ac1f24739aed1a5 Mon Sep 17 00:00:00 2001
From: Andrew White
Date: Tue, 29 Oct 2024 10:33:01 +0000
Subject: [PATCH 04/10] Remove unused method and limit sponsors to 0..10
---
app/models/site.rb | 10 +---------
spec/models/site_spec.rb | 33 +++++----------------------------
2 files changed, 6 insertions(+), 37 deletions(-)
diff --git a/app/models/site.rb b/app/models/site.rb
index e17fcb3d7..2cd41a7e2 100644
--- a/app/models/site.rb
+++ b/app/models/site.rb
@@ -50,10 +50,6 @@ def enabled?
instance.enabled?
end
- def formatted_threshold_for_moderation
- instance.formatted_threshold_for_moderation
- end
-
def formatted_threshold_for_response
instance.formatted_threshold_for_response
end
@@ -455,10 +451,6 @@ def email_protocol
uri.scheme
end
- def formatted_threshold_for_moderation
- number_to_delimited(threshold_for_moderation)
- end
-
def formatted_threshold_for_response
number_to_delimited(threshold_for_response)
end
@@ -549,7 +541,7 @@ def signature_count_updated_at
validates :petition_duration, presence: true, numericality: { only_integer: true }
validates :minimum_number_of_sponsors, presence: true, numericality: { only_integer: true }
validates :maximum_number_of_sponsors, presence: true, numericality: { only_integer: true }
- validates :threshold_for_moderation, presence: true, numericality: { only_integer: true }
+ validates :threshold_for_moderation, presence: true, numericality: { only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 10 }
validates :threshold_for_moderation_delay, presence: true, numericality: { only_integer: true }
validates :threshold_for_response, presence: true, numericality: { only_integer: true }
validates :threshold_for_debate, presence: true, numericality: { only_integer: true }
diff --git a/spec/models/site_spec.rb b/spec/models/site_spec.rb
index 2450c0c38..032382666 100644
--- a/spec/models/site_spec.rb
+++ b/spec/models/site_spec.rb
@@ -67,24 +67,16 @@
it { is_expected.to validate_length_of(:moderation_delay_message).is_at_most(500) }
- %w[
+ %i[
petition_duration minimum_number_of_sponsors maximum_number_of_sponsors threshold_for_moderation
threshold_for_moderation_delay threshold_for_response threshold_for_debate login_timeout
].each do |attribute|
- describe attribute do
- let(:errors) { subject.errors[attribute] }
- let(:message) { "#{attribute.humanize} must be an integer" }
-
- before do
- subject.update(attribute => '0.1')
- end
-
- it "only accepts integers" do
- expect(errors).to include(message)
- end
- end
+ it { is_expected.to validate_numericality_of(attribute).only_integer }
end
+ it { is_expected.to validate_numericality_of(:threshold_for_moderation).is_greater_than_or_equal_to(0) }
+ it { is_expected.to validate_numericality_of(:threshold_for_moderation).is_less_than_or_equal_to(10) }
+
context "when protected" do
subject { described_class.new(protected: true) }
@@ -216,11 +208,6 @@
expect(Site.threshold_for_moderation).to eq(5)
end
- it "delegates formatted_threshold_for_moderation to the instance" do
- expect(site).to receive(:formatted_threshold_for_moderation).and_return("5,000")
- expect(Site.formatted_threshold_for_moderation).to eq("5,000")
- end
-
it "delegates threshold_for_response to the instance" do
expect(site).to receive(:threshold_for_response).and_return(10)
expect(Site.threshold_for_response).to eq(10)
@@ -801,16 +788,6 @@
end
end
- describe "#formatted_threshold_for_moderation" do
- subject :site do
- described_class.create!(threshold_for_moderation: 5000)
- end
-
- it "returns a formatted number" do
- expect(site.formatted_threshold_for_moderation).to eq("5,000")
- end
- end
-
describe "#formatted_threshold_for_response" do
subject :site do
described_class.create!(threshold_for_response: 10000)
From b3e08026b63bfc3b5498d5a2c51f7973e1d58d02 Mon Sep 17 00:00:00 2001
From: Andrew White
Date: Tue, 29 Oct 2024 10:33:59 +0000
Subject: [PATCH 05/10] Add method to convert number to word
---
app/helpers/application_helper.rb | 4 ++++
config/locales/en-GB.yml | 12 ++++++++++++
2 files changed, 16 insertions(+)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index c8bd86b1e..400122c54 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -51,6 +51,10 @@ def original_url
request.original_url.force_encoding('utf-8')
end
+ def number_to_word(number)
+ I18n.t(number, scope: :"number.words")
+ end
+
private
def referer_url
diff --git a/config/locales/en-GB.yml b/config/locales/en-GB.yml
index 941bf7e55..2a4b79056 100644
--- a/config/locales/en-GB.yml
+++ b/config/locales/en-GB.yml
@@ -199,6 +199,18 @@ en-GB:
precision:
format:
delimiter: ''
+ words:
+ 0: zero
+ 1: one
+ 2: two
+ 3: three
+ 4: four
+ 5: five
+ 6: six
+ 7: seven
+ 8: eight
+ 9: nine
+ 10: ten
support:
array:
last_word_connector: ", and "
From 20e4de8bee2b595504cb8433a52c443986875804 Mon Sep 17 00:00:00 2001
From: Andrew White
Date: Tue, 29 Oct 2024 10:41:12 +0000
Subject: [PATCH 06/10] Extract sponsor mailer subjects to the locale file
---
app/mailers/sponsor_mailer.rb | 23 +++++++++++++++++++----
config/locales/petitions.en-GB.yml | 6 ++++++
2 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/app/mailers/sponsor_mailer.rb b/app/mailers/sponsor_mailer.rb
index 19db64dde..9991e85a4 100644
--- a/app/mailers/sponsor_mailer.rb
+++ b/app/mailers/sponsor_mailer.rb
@@ -4,7 +4,7 @@ def sponsor_signed_email_below_threshold(sponsor)
@sponsor_count = @petition.sponsor_count
mail(
- subject: "#{@sponsor.name} supported your petition",
+ subject: subject_for(:sponsor_signed_email_below_threshold),
to: @petition.creator.email
)
end
@@ -14,7 +14,7 @@ def sponsor_signed_email_on_threshold(sponsor)
@sponsor_count = @petition.sponsor_count
mail(
- subject: "We’re checking your petition",
+ subject: subject_for(:sponsor_signed_email_on_threshold),
to: @petition.creator.email
)
end
@@ -23,9 +23,24 @@ def petition_and_email_confirmation_for_sponsor(sponsor)
@petition, @sponsor = sponsor.petition, sponsor
mail(
- subject: "Please confirm your email address",
+ subject: subject_for(:petition_and_email_confirmation_for_sponsor),
to: @sponsor.email
)
end
-end
+ private
+
+ def subject_for(key, options = {})
+ I18n.t key, **(i18n_options.merge(options))
+ end
+
+ def i18n_options
+ {}.tap do |options|
+ options[:scope] = :"petitions.emails.subjects"
+
+ if defined?(@sponsor)
+ options[:name] = @sponsor.name
+ end
+ end
+ end
+end
diff --git a/config/locales/petitions.en-GB.yml b/config/locales/petitions.en-GB.yml
index 228875159..5ee98eed5 100644
--- a/config/locales/petitions.en-GB.yml
+++ b/config/locales/petitions.en-GB.yml
@@ -194,6 +194,12 @@ en-GB:
We rejected your petition “%{action}”
notify_sponsor_that_petition_was_rejected: |-
We rejected the petition “%{action}” that you supported
+ petition_and_email_confirmation_for_sponsor: |-
+ Please confirm your email address
+ sponsor_signed_email_below_threshold: |-
+ %{name} supported your petition
+ sponsor_signed_email_on_threshold: |-
+ We’re checking your petition
# Re-send confirmation emails
special_resend_of_email_confirmation_for_signer: |-
From bb145b78cea9a537ddf87ad37073d19732f051ec Mon Sep 17 00:00:00 2001
From: Andrew White
Date: Tue, 29 Oct 2024 11:18:19 +0000
Subject: [PATCH 07/10] Move number_to_word to separate helper for inclusion in
mailers
---
app/helpers/application_helper.rb | 4 ----
app/helpers/number_helper.rb | 5 +++++
2 files changed, 5 insertions(+), 4 deletions(-)
create mode 100644 app/helpers/number_helper.rb
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 400122c54..c8bd86b1e 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -51,10 +51,6 @@ def original_url
request.original_url.force_encoding('utf-8')
end
- def number_to_word(number)
- I18n.t(number, scope: :"number.words")
- end
-
private
def referer_url
diff --git a/app/helpers/number_helper.rb b/app/helpers/number_helper.rb
new file mode 100644
index 000000000..fd0ccbf70
--- /dev/null
+++ b/app/helpers/number_helper.rb
@@ -0,0 +1,5 @@
+module NumberHelper
+ def number_to_word(number)
+ I18n.t(number, scope: :"number.words")
+ end
+end
From 7c9a609c5df140f040dc017a2a3cf0bc6884e8c0 Mon Sep 17 00:00:00 2001
From: Andrew White
Date: Tue, 29 Oct 2024 12:41:46 +0000
Subject: [PATCH 08/10] Replace before_remove_const with on_unload
---
app/models/constituency/api_query.rb | 4 ----
app/models/holiday.rb | 4 ----
app/models/parliament.rb | 4 ----
app/models/site.rb | 4 ----
config/initializers/zeitwerk.rb | 9 +++++++++
spec/models/parliament_spec.rb | 16 ----------------
spec/models/site_spec.rb | 16 ----------------
7 files changed, 9 insertions(+), 48 deletions(-)
diff --git a/app/models/constituency/api_query.rb b/app/models/constituency/api_query.rb
index 080a6297d..3629a583a 100644
--- a/app/models/constituency/api_query.rb
+++ b/app/models/constituency/api_query.rb
@@ -38,10 +38,6 @@ def fetch(postcode)
return []
end
- def self.before_remove_const
- Thread.current[:__api_client__] = nil
- end
-
private
def client
diff --git a/app/models/holiday.rb b/app/models/holiday.rb
index 6f0b1b39b..6f8511036 100644
--- a/app/models/holiday.rb
+++ b/app/models/holiday.rb
@@ -1,9 +1,5 @@
class Holiday < ActiveRecord::Base
class << self
- def before_remove_const
- Thread.current[:__holiday__] = nil
- end
-
def instance
Thread.current[:__holiday__] ||= first_or_create(defaults)
end
diff --git a/app/models/parliament.rb b/app/models/parliament.rb
index 64eca0987..d7fb0e1bc 100644
--- a/app/models/parliament.rb
+++ b/app/models/parliament.rb
@@ -10,10 +10,6 @@ class Parliament < ActiveRecord::Base
has_many :constituencies, through: :parliament_constituencies
class << self
- def before_remove_const
- Thread.current[:__parliament__] = nil
- end
-
def instance
Thread.current[:__parliament__] ||= current_or_create
end
diff --git a/app/models/site.rb b/app/models/site.rb
index 2cd41a7e2..966e167bd 100644
--- a/app/models/site.rb
+++ b/app/models/site.rb
@@ -30,10 +30,6 @@ def table_exists?
false
end
- def before_remove_const
- Thread.current[:__site__] = nil
- end
-
def instance
Thread.current[:__site__] ||= first_or_create(defaults)
end
diff --git a/config/initializers/zeitwerk.rb b/config/initializers/zeitwerk.rb
index 71a958264..45789d400 100644
--- a/config/initializers/zeitwerk.rb
+++ b/config/initializers/zeitwerk.rb
@@ -4,3 +4,12 @@
"petition_csv_presenter" => "PetitionCSVPresenter",
)
end
+
+unless Rails.application.config.cache_classes
+ Rails.autoloaders.main.tap do |autoloader|
+ autoloader.on_unload("Constituency::ApiClient") { Thread.current[:__api_client__] = nil }
+ autoloader.on_unload("Holiday") { Thread.current[:__holiday__] = nil }
+ autoloader.on_unload("Parliament") { Thread.current[:__parliament__] = nil }
+ autoloader.on_unload("Site") { Thread.current[:__site__] = nil }
+ end
+end
diff --git a/spec/models/parliament_spec.rb b/spec/models/parliament_spec.rb
index b4165b39c..f959a9899 100644
--- a/spec/models/parliament_spec.rb
+++ b/spec/models/parliament_spec.rb
@@ -314,22 +314,6 @@
end
end
- describe ".before_remove_const" do
- let(:parliament) { FactoryBot.create(:parliament) }
-
- context "when it is cached in Thread.current" do
- before do
- Thread.current[:__parliament__] = parliament
- end
-
- it "clears the cached instance in Thread.current" do
- expect{ Parliament.before_remove_const }.to change {
- Thread.current[:__parliament__]
- }.from(parliament).to(nil)
- end
- end
- end
-
describe "#opened?" do
context "when opening_at is nil" do
subject :parliament do
diff --git a/spec/models/site_spec.rb b/spec/models/site_spec.rb
index 032382666..468f231f4 100644
--- a/spec/models/site_spec.rb
+++ b/spec/models/site_spec.rb
@@ -744,22 +744,6 @@
end
end
- describe ".before_remove_const" do
- let(:site) { described_class.create! }
-
- context "when it is cached in Thread.current" do
- before do
- Thread.current[:__site__] = site
- end
-
- it "clears the cached instance in Thread.current" do
- expect{ Site.before_remove_const }.to change {
- Thread.current[:__site__]
- }.from(site).to(nil)
- end
- end
- end
-
describe "#authenticate" do
subject :site do
described_class.create!(username: "petitions", password: "letmein")
From e480e2106ae3fb735d03263f55d3bb48413e75f7 Mon Sep 17 00:00:00 2001
From: Andrew White
Date: Tue, 29 Oct 2024 13:39:58 +0000
Subject: [PATCH 09/10] Make the feedback mock signature quack like an Active
Model
---
app/models/feedback_signature.rb | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/app/models/feedback_signature.rb b/app/models/feedback_signature.rb
index 014b49f61..5fb47557e 100644
--- a/app/models/feedback_signature.rb
+++ b/app/models/feedback_signature.rb
@@ -1,4 +1,16 @@
FeedbackSignature = Struct.new(:petition, :name, :email) do
+ def model_name
+ @_model_name ||= ActiveModel::Name.new(self, nil, "Signature")
+ end
+
+ def to_model
+ self
+ end
+
+ def persisted?
+ true
+ end
+
def name
self[:name] || 'Petitions team'
end
@@ -15,6 +27,14 @@ def to_param
'0'
end
+ def creator?
+ false
+ end
+
+ def sponsor?
+ false
+ end
+
def anonymized?
false
end
From 4e0528589817b683f78ca5a26b5d59a56fb783e1 Mon Sep 17 00:00:00 2001
From: Andrew White
Date: Tue, 29 Oct 2024 16:12:29 +0000
Subject: [PATCH 10/10] Initial pass at updating emails for the new parliament
These can be done after opening:
- Debate outcomes
- Petition emails
- Petition mailshots
- Petitions closing early
- Petitions being stopped
---
app/mailers/application_mailer.rb | 2 +-
app/mailers/sponsor_mailer.rb | 7 +
...otify_creator_of_debate_scheduled.html.erb | 18 ++-
...otify_creator_of_debate_scheduled.text.erb | 23 ++-
...ify_creator_of_threshold_response.html.erb | 16 +-
...ify_creator_of_threshold_response.text.erb | 17 +-
...notify_signer_of_debate_scheduled.html.erb | 18 ++-
...notify_signer_of_debate_scheduled.text.erb | 23 ++-
...tify_signer_of_threshold_response.html.erb | 18 +--
...tify_signer_of_threshold_response.text.erb | 17 +-
app/views/layouts/default_mail.html.erb | 39 ++++-
.../email_confirmation_for_signer.html.erb | 4 +-
.../email_confirmation_for_signer.text.erb | 6 +-
.../email_duplicate_signatures.html.erb | 7 +-
.../email_duplicate_signatures.text.erb | 6 +-
.../gather_sponsors_for_petition.html.erb | 34 ++--
.../gather_sponsors_for_petition.text.erb | 35 ++---
...otify_creator_of_debate_scheduled.html.erb | 18 ++-
...otify_creator_of_debate_scheduled.text.erb | 23 ++-
...ify_creator_of_threshold_response.html.erb | 16 +-
...ify_creator_of_threshold_response.text.erb | 17 +-
...reator_that_petition_is_published.html.erb | 20 ++-
...reator_that_petition_is_published.text.erb | 18 ++-
...reator_that_petition_was_rejected.html.erb | 17 +-
...reator_that_petition_was_rejected.text.erb | 24 +--
...notify_signer_of_debate_scheduled.html.erb | 18 ++-
...notify_signer_of_debate_scheduled.text.erb | 23 ++-
...tify_signer_of_threshold_response.html.erb | 18 +--
...tify_signer_of_threshold_response.text.erb | 17 +-
...ponsor_that_petition_is_published.html.erb | 20 ++-
...ponsor_that_petition_is_published.text.erb | 18 ++-
...ponsor_that_petition_was_rejected.html.erb | 14 +-
...ponsor_that_petition_was_rejected.text.erb | 17 +-
...nd_email_confirmation_for_sponsor.html.erb | 15 +-
...nd_email_confirmation_for_sponsor.text.erb | 10 +-
...nsor_signed_email_below_threshold.html.erb | 9 +-
...nsor_signed_email_below_threshold.text.erb | 9 +-
...sponsor_signed_email_on_threshold.html.erb | 20 +--
...sponsor_signed_email_on_threshold.text.erb | 28 ++--
config/locales/petitions.en-GB.yml | 50 +++---
...gns_charlies_petition_as_a_sponsor.feature | 6 +-
...petition_with_suzies_email_address.feature | 6 +-
.../debate_scheduled_steps.rb | 4 +-
features/step_definitions/moderation_steps.rb | 4 +-
features/step_definitions/signature_steps.rb | 9 +-
features/step_definitions/sponsor_steps.rb | 10 +-
.../sponsor_support_nofitication_steps.rb | 15 +-
features/suzie_signs_a_petition.feature | 6 +-
.../government_response_controller_spec.rb | 8 +-
.../government_response_controller_spec.rb | 8 +-
.../admin/moderation_controller_spec.rb | 12 +-
.../admin/petitions_controller_spec.rb | 4 +-
.../admin/take_down_controller_spec.rb | 8 +-
spec/controllers/petitions_controller_spec.rb | 2 +-
.../controllers/signatures_controller_spec.rb | 10 +-
spec/controllers/sponsors_controller_spec.rb | 18 +--
spec/mailers/archived/petition_mailer_spec.rb | 76 ++++-----
spec/mailers/petition_mailer_spec.rb | 145 +++---------------
spec/mailers/sponsor_mailer_spec.rb | 119 +-------------
59 files changed, 535 insertions(+), 664 deletions(-)
diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb
index 96131de20..205d1f1d9 100644
--- a/app/mailers/application_mailer.rb
+++ b/app/mailers/application_mailer.rb
@@ -2,7 +2,7 @@ class ApplicationMailer < ActionMailer::Base
default_url_options[:protocol] = Site.email_protocol
default from: ->(email){ Site.email_from }
- helper :date_time, :rejection, :auto_link, :markdown, :moderation
+ helper :date_time, :rejection, :auto_link, :markdown, :moderation, :number
layout 'default_mail'
end
diff --git a/app/mailers/sponsor_mailer.rb b/app/mailers/sponsor_mailer.rb
index 9991e85a4..bfd0b826a 100644
--- a/app/mailers/sponsor_mailer.rb
+++ b/app/mailers/sponsor_mailer.rb
@@ -1,4 +1,6 @@
class SponsorMailer < ApplicationMailer
+ include NumberHelper
+
def sponsor_signed_email_below_threshold(sponsor)
@petition, @sponsor = sponsor.petition, sponsor
@sponsor_count = @petition.sponsor_count
@@ -37,10 +39,15 @@ def subject_for(key, options = {})
def i18n_options
{}.tap do |options|
options[:scope] = :"petitions.emails.subjects"
+ options[:threshold] = number_to_word(Site.threshold_for_moderation)
if defined?(@sponsor)
options[:name] = @sponsor.name
end
+
+ if defined?(@petition)
+ options[:action] = @petition.action
+ end
end
end
end
diff --git a/app/views/archived/petition_mailer/notify_creator_of_debate_scheduled.html.erb b/app/views/archived/petition_mailer/notify_creator_of_debate_scheduled.html.erb
index faa357842..0f8c6ccd6 100644
--- a/app/views/archived/petition_mailer/notify_creator_of_debate_scheduled.html.erb
+++ b/app/views/archived/petition_mailer/notify_creator_of_debate_scheduled.html.erb
@@ -1,13 +1,23 @@
<%= render "reason" %>
Dear <%= @signature.name %>,
-Parliament is going to debate your petition – “<%= @petition.action %>”.
-
-<%= link_to nil, archived_petition_url(@petition) %>
+MPs are going to debate your petition – “<%= link_to @petition.action, archived_petition_url(@petition) %>”.
The debate is scheduled for <%= short_date_format(@petition.scheduled_debate_date) %>.
-Once the debate has happened, we’ll email you a video and transcript.
+You can watch the debate live on Youtube or parliamentlive.tv.
+
+You can read a transcript of the debate a few hours after it ends.
+
+After the debate, we’ll email you a video and transcript.
+
+Petition debates
+
+Petition debates allow MPs from all parties to discuss the issues raised by petitions.
+
+They don’t end with a vote to implement the request of a petition.
+
+Find out more
<%= render "footer" %>
<%= render "unsubscribe" %>
diff --git a/app/views/archived/petition_mailer/notify_creator_of_debate_scheduled.text.erb b/app/views/archived/petition_mailer/notify_creator_of_debate_scheduled.text.erb
index d5bd2867e..a22e4d76c 100644
--- a/app/views/archived/petition_mailer/notify_creator_of_debate_scheduled.text.erb
+++ b/app/views/archived/petition_mailer/notify_creator_of_debate_scheduled.text.erb
@@ -1,13 +1,28 @@
<%= render "reason" %>
Dear <%= @signature.name %>,
-Parliament is going to debate your petition – “<%= @petition.action %>”.
-
-<%= archived_petition_url(@petition) %>
+MPs are going to debate your petition – “<%= @petition.action %>”.
The debate is scheduled for <%= short_date_format(@petition.scheduled_debate_date) %>.
-Once the debate has happened, we’ll email you a video and transcript.
+You can watch the debate live on [Youtube][1] or [parliamentlive.tv][2].
+
+You can read a [transcript of the debate][3] a few hours after it ends.
+
+After the debate, we’ll email you a video and transcript.
+
+### Petition debates
+
+Petition debates allow MPs from all parties to discuss the issues raised by petitions.
+
+They don’t end with a vote to implement the request of a petition.
+
+[Find out more][4]
+
+[1]: http://www.youtube.com/ukparliament
+[2]: https://parliamentlive.tv/Commons
+[3]: https://hansard.parliament.uk/
+[4]: https://committees.parliament.uk/committee/326/petitions-committee/content/194347/how-petitions-debates-work/
<%= render "footer" %>
<%= render "unsubscribe" %>
diff --git a/app/views/archived/petition_mailer/notify_creator_of_threshold_response.html.erb b/app/views/archived/petition_mailer/notify_creator_of_threshold_response.html.erb
index fdf8e2f02..f861d25e9 100644
--- a/app/views/archived/petition_mailer/notify_creator_of_threshold_response.html.erb
+++ b/app/views/archived/petition_mailer/notify_creator_of_threshold_response.html.erb
@@ -1,25 +1,13 @@
<%= render "reason" %>
Dear <%= @signature.name %>,
-The Government has responded to your petition – “<%= link_to @petition.action, archived_petition_url(@petition) %>”.
-
-Government responded:
+The <%= link_to "Government has responded", archived_petition_url(@petition, reveal_response: "yes") %> to your petition: “<%= @petition.action %>”.
<%= auto_link(simple_format(h(@government_response.summary))) %>
<%= auto_link(simple_format(h(@government_response.details))) %>
-Click this link to view the response online:
-
-<%= link_to nil, archived_petition_url(@petition, reveal_response: "yes") %>
-
-<% if @petition.signature_count < @parliament.threshold_for_debate %>
-The Petitions Committee will take a look at this petition and its response. They can press the government for action and gather evidence. If this petition reaches <%= @parliament.formatted_threshold_for_debate %> signatures, the Committee will consider it for a debate.
-<% else %>
-This petition has over <%= @parliament.formatted_threshold_for_debate %> signatures. The Petitions Committee will consider it for a debate. They can also gather further evidence and press the government for action.
-<% end %>
-
-The Committee is made up of 11 MPs, from political parties in government and in opposition. It is entirely independent of the Government. Find out more about the Committee: <%= link_to nil, help_url(anchor: 'petitions-committee') %>
+If it reaches <%= Site.formatted_threshold_for_debate %> signatures, the Petitions Committee will consider whether MPs debate it in the House of Commons.
<%= render "footer" %>
<%= render "unsubscribe" %>
diff --git a/app/views/archived/petition_mailer/notify_creator_of_threshold_response.text.erb b/app/views/archived/petition_mailer/notify_creator_of_threshold_response.text.erb
index 92a71790c..6565bdbfa 100644
--- a/app/views/archived/petition_mailer/notify_creator_of_threshold_response.text.erb
+++ b/app/views/archived/petition_mailer/notify_creator_of_threshold_response.text.erb
@@ -1,25 +1,14 @@
<%= render "reason" %>
Dear <%= @signature.name %>,
-The Government has responded to your petition – “<%= @petition.action %>”.
-
-Government responded:
+The Government has responded to your petition: “<%= @petition.action %>”.
+<%= archived_petition_url(@petition, reveal_response: "yes") %>
<%= h(@government_response.summary) %>
<%= h(@government_response.details) %>
-Click this link to view the response online:
-
-<%= archived_petition_url(@petition, reveal_response: "yes") %>
-
-<% if @petition.signature_count < Site.threshold_for_debate %>
-The Petitions Committee will take a look at this petition and its response. They can press the government for action and gather evidence. If this petition reaches <%= Site.formatted_threshold_for_debate %> signatures, the Committee will consider it for a debate.
-<% else %>
-This petition has over <%= Site.formatted_threshold_for_debate %> signatures. The Petitions Committee will consider it for a debate. They can also gather further evidence and press the government for action.
-<% end %>
-
-The Committee is made up of 11 MPs, from political parties in government and in opposition. It is entirely independent of the Government. Find out more about the Committee: <%= help_url(anchor: 'petitions-committee') %>
+If it reaches <%= Site.formatted_threshold_for_debate %> signatures, the Petitions Committee will consider whether MPs debate it in the House of Commons.
<%= render "footer" %>
<%= render "unsubscribe" %>
diff --git a/app/views/archived/petition_mailer/notify_signer_of_debate_scheduled.html.erb b/app/views/archived/petition_mailer/notify_signer_of_debate_scheduled.html.erb
index 1a1593171..addcf6b27 100644
--- a/app/views/archived/petition_mailer/notify_signer_of_debate_scheduled.html.erb
+++ b/app/views/archived/petition_mailer/notify_signer_of_debate_scheduled.html.erb
@@ -1,13 +1,23 @@
<%= render "reason" %>
Dear <%= @signature.name %>,
-Parliament is going to debate the petition you signed – “<%= @petition.action %>”.
-
-<%= link_to nil, archived_petition_url(@petition) %>
+MPs are going to debate the petition you signed: “<%= link_to @petition.action, archived_petition_url(@petition) %>”.
The debate is scheduled for <%= short_date_format(@petition.scheduled_debate_date) %>.
-Once the debate has happened, we’ll email you a video and transcript.
+You can watch the debate live on Youtube or parliamentlive.tv.
+
+You can read a transcript of the debate a few hours after it ends.
+
+After the debate, we’ll email you a video and transcript.
+
+Petition debates
+
+Petition debates allow MPs from all parties to discuss the issues raised by petitions.
+
+They don’t end with a vote to implement the request of a petition.
+
+Find out more
<%= render "footer" %>
<%= render "unsubscribe" %>
diff --git a/app/views/archived/petition_mailer/notify_signer_of_debate_scheduled.text.erb b/app/views/archived/petition_mailer/notify_signer_of_debate_scheduled.text.erb
index eda043605..1d57cfe7f 100644
--- a/app/views/archived/petition_mailer/notify_signer_of_debate_scheduled.text.erb
+++ b/app/views/archived/petition_mailer/notify_signer_of_debate_scheduled.text.erb
@@ -1,13 +1,28 @@
<%= render "reason" %>
Dear <%= @signature.name %>,
-Parliament is going to debate the petition you signed – “<%= @petition.action %>”.
-
-<%= archived_petition_url(@petition) %>
+MPs are going to debate the petition you signed: “<%= @petition.action %>”.
The debate is scheduled for <%= short_date_format(@petition.scheduled_debate_date) %>.
-Once the debate has happened, we’ll email you a video and transcript.
+You can watch the debate live on [Youtube][1] or [parliamentlive.tv][2].
+
+You can read a [transcript of the debate][3] a few hours after it ends.
+
+After the debate, we’ll email you a video and transcript.
+
+### Petition debates
+
+Petition debates allow MPs from all parties to discuss the issues raised by petitions.
+
+They don’t end with a vote to implement the request of a petition.
+
+[Find out more][4]
+
+[1]: http://www.youtube.com/ukparliament
+[2]: https://parliamentlive.tv/Commons
+[3]: https://hansard.parliament.uk/
+[4]: https://committees.parliament.uk/committee/326/petitions-committee/content/194347/how-petitions-debates-work/
<%= render "footer" %>
<%= render "unsubscribe" %>
diff --git a/app/views/archived/petition_mailer/notify_signer_of_threshold_response.html.erb b/app/views/archived/petition_mailer/notify_signer_of_threshold_response.html.erb
index 57957c1f7..794cdb0e1 100644
--- a/app/views/archived/petition_mailer/notify_signer_of_threshold_response.html.erb
+++ b/app/views/archived/petition_mailer/notify_signer_of_threshold_response.html.erb
@@ -1,25 +1,13 @@
<%= render "reason" %>
Dear <%= @signature.name %>,
-The Government has responded to the petition you signed – “<%= link_to @petition.action, archived_petition_url(@petition) %>”.
-
-Government responded:
+The Government has responded to the petition you signed.
<%= auto_link(simple_format(h(@government_response.summary))) %>
-<%= auto_link(simple_format(h(@government_response.details))) %>
-
-Click this link to view the response online:
-
-<%= link_to nil, archived_petition_url(@petition, reveal_response: "yes") %>
-
-<% if @petition.signature_count < @parliament.threshold_for_debate %>
-The Petitions Committee will take a look at this petition and its response. They can press the government for action and gather evidence. If this petition reaches <%= @parliament.formatted_threshold_for_debate %> signatures, the Committee will consider it for a debate.
-<% else %>
-This petition has over <%= @parliament.formatted_threshold_for_debate %> signatures. The Petitions Committee will consider it for a debate. They can also gather further evidence and press the government for action.
-<% end %>
+<%= link_to "Read the full response", archived_petition_url(@petition, reveal_response: "yes") %>.
-The Committee is made up of 11 MPs, from political parties in government and in opposition. It is entirely independent of the Government. Find out more about the Committee: <%= link_to nil, help_url(anchor: 'petitions-committee') %>
+If <%= Site.formatted_threshold_for_debate %> people sign the petition, the Petitions Committee will consider whether MPs debate it in Parliament.
<%= render "footer" %>
<%= render "unsubscribe" %>
diff --git a/app/views/archived/petition_mailer/notify_signer_of_threshold_response.text.erb b/app/views/archived/petition_mailer/notify_signer_of_threshold_response.text.erb
index 65b0f2c39..c3997607a 100644
--- a/app/views/archived/petition_mailer/notify_signer_of_threshold_response.text.erb
+++ b/app/views/archived/petition_mailer/notify_signer_of_threshold_response.text.erb
@@ -1,25 +1,14 @@
<%= render "reason" %>
Dear <%= @signature.name %>,
-The Government has responded to the petition you signed – “<%= @petition.action %>”.
-
-Government responded:
+The Government has responded to the petition you signed.
<%= h(@government_response.summary) %>
-<%= h(@government_response.details) %>
-
-Click this link to view the response online:
-
+Read the full response:
<%= archived_petition_url(@petition, reveal_response: "yes") %>
-<% if @petition.signature_count < @parliament.threshold_for_debate %>
-The Petitions Committee will take a look at this petition and its response. They can press the government for action and gather evidence. If this petition reaches <%= @parliament.formatted_threshold_for_debate %> signatures, the Committee will consider it for a debate.
-<% else %>
-This petition has over <%= @parliament.formatted_threshold_for_debate %> signatures. The Petitions Committee will consider it for a debate. They can also gather further evidence and press the government for action.
-<% end %>
-
-The Committee is made up of 11 MPs, from political parties in government and in opposition. It is entirely independent of the Government. Find out more about the Committee: <%= help_url(anchor: 'petitions-committee') %>
+If <%= Site.formatted_threshold_for_debate %> people sign the petition, the Petitions Committee will consider whether MPs debate it in Parliament.
<%= render "footer" %>
<%= render "unsubscribe" %>
diff --git a/app/views/layouts/default_mail.html.erb b/app/views/layouts/default_mail.html.erb
index 41d4e2ce5..3caf191ac 100644
--- a/app/views/layouts/default_mail.html.erb
+++ b/app/views/layouts/default_mail.html.erb
@@ -2,11 +2,39 @@
@@ -37,4 +65,3 @@