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 @@ - 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 210735c86..f5ba7b06f 100644 --- a/app/views/petition_mailer/email_confirmation_for_signer.html.erb +++ b/app/views/petition_mailer/email_confirmation_for_signer.html.erb @@ -1,5 +1,5 @@ -

Click this link to sign the petition "<%= @petition.action %>"

+

Dear <%= @signature.name %>,

-

<%= link_to nil, verify_signature_url(@signature, token: @signature.perishable_token) %>

+

Please <%= link_to "confirm your email", verify_signature_url(@signature, token: @signature.perishable_token) %> to sign the petition: “<%= link_to @petition.action, petition_url(@petition) %>”.

<%= 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 d5f6d960f..08568f392 100644 --- a/app/views/petition_mailer/email_confirmation_for_signer.text.erb +++ b/app/views/petition_mailer/email_confirmation_for_signer.text.erb @@ -1,5 +1,9 @@ -Click this link to sign the petition "<%= @petition.action %>" +Dear <%= @signature.name %>, +Please confirm your email: <%= verify_signature_url(@signature, token: @signature.perishable_token) %> +to sign the petition “<%= @petition.action %>”: +<%= petition_url(@petition) %> + <%= render "footer" %> diff --git a/app/views/petition_mailer/email_duplicate_signatures.html.erb b/app/views/petition_mailer/email_duplicate_signatures.html.erb index 405fcc83d..d8d842c88 100644 --- a/app/views/petition_mailer/email_duplicate_signatures.html.erb +++ b/app/views/petition_mailer/email_duplicate_signatures.html.erb @@ -1,6 +1,7 @@ -

You're receiving this email because your email has been used to sign the petition “<%= @petition.action %>”, but you have already signed this petition.

+

Dear <%= @signature.name %>,

-

View the petition “<%= @petition.action %>” at:
-<%= link_to nil, petition_url(@petition) %>

+

Your email has been used to sign the petition: “<%= link_to @petition.action, petition_url(@petition) %>”.

+ +

You have already signed it, so your signature cannot be accepted.

<%= 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 998a6e25f..9bcdd6e18 100644 --- a/app/views/petition_mailer/email_duplicate_signatures.text.erb +++ b/app/views/petition_mailer/email_duplicate_signatures.text.erb @@ -1,6 +1,8 @@ -You're receiving this email because your email has been used to sign the petition “<%= @petition.action %>”, but you have already signed this petition. +Dear <%= @signature.name %>, -View the petition “<%= @petition.action %>” at: +Your email has been used to sign the petition “<%= @petition.action %>": <%= petition_url(@petition) %> +You have already signed it, so your signature cannot be accepted. + <%= render "footer" %> 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 a4f0cf524..666875d19 100644 --- a/app/views/petition_mailer/gather_sponsors_for_petition.html.erb +++ b/app/views/petition_mailer/gather_sponsors_for_petition.html.erb @@ -1,33 +1,26 @@ +

You’re receiving this email because you created the petition: “<%= link_to @petition.action, new_petition_sponsor_url(@petition, token: @petition.sponsor_token) %>”.

+

Dear <%= @creator.name %>,

You’re not done yet!

-

Forward the email below to your potential supporters.

+

<%= number_to_word(Site.threshold_for_moderation).titleize %> people need to sign your petition for us to check it.

-

<%= Site.threshold_for_moderation %> people need to click the link and confirm their support for us to check your petition.

+

Share <%= link_to "your petition", new_petition_sponsor_url(@petition, token: @petition.sponsor_token) %> with your potential supporters, or send them the information at the bottom of this email.

-<% if moderation_delay? %> -

Once you’ve gained the required number of supporters, we’ll check your petition to make sure it meets the petition standards. If it does, we’ll publish it. <%= moderation_delay_message %>

-<% elsif christmas_period? %> -

Once you’ve gained the required number of supporters, we’ll check your petition to make sure it meets the petition standards. If it does, we’ll publish it. This usually takes a week or less but over the Christmas period it will take us a little longer than usual. We’ll check your petition as quickly as we can.

-<% elsif easter_period? %> -

Once you’ve gained the required number of supporters, we’ll check your petition to make sure it meets the petition standards. If it does, we’ll publish it. This usually takes a week or less but over the Easter period it will take us a little longer than usual. We’ll check your petition as quickly as we can.

-<% else %> -

Once you’ve gained the required number of supporters, we’ll check your petition to make sure it meets the petition standards. If it does, we’ll publish it. This usually takes a week or less.

-<% end %> +

Once you’ve gained <%= number_to_word(Site.threshold_for_moderation) %> signatures, we’ll check your petition to make sure it meets the <%= link_to "petition standards", help_url(anchor: 'standards') %>. If it does, we’ll publish it. If it doesn’t, we’ll let you know why.

-

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.

+

This can take up to 10 working days. Thank you for your patience.

-<%= render "footer" %> +

Up to <%= Site.maximum_number_of_sponsors %> people can sign your petition while we are checking it. Please wait until it’s been checked and published before sharing it more widely.

-
+<%= render "footer" %> -

I’ve made a petition – will you sign it?

+
-

Click this link to sign the petition:
-<%= link_to nil, new_petition_sponsor_url(@petition, token: @petition.sponsor_token) %>

+

I want to start a petition – will you sign it?

-

My petition:

+

<%= link_to "Sign the petition", new_petition_sponsor_url(@petition, token: @petition.sponsor_token) %>

<%= @petition.action %>

@@ -37,7 +30,4 @@

<%= @petition.additional_details %>

<% end %> -
- -

Click this link to sign the petition:
-<%= link_to nil, new_petition_sponsor_url(@petition, token: @petition.sponsor_token) %>

+

<%= link_to "Sign the petition", new_petition_sponsor_url(@petition, token: @petition.sponsor_token) %>

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 96d29db36..621886d5e 100644 --- a/app/views/petition_mailer/gather_sponsors_for_petition.text.erb +++ b/app/views/petition_mailer/gather_sponsors_for_petition.text.erb @@ -1,34 +1,31 @@ +You’re receiving this email because you created the petition: “<%= @petition.action %>”. +<%= new_petition_sponsor_url(@petition, token: @petition.sponsor_token) %> + +-- + Dear <%= @creator.name %>, You’re not done yet! -Forward the email below to your potential supporters. +<%= number_to_word(Site.threshold_for_moderation).titleize %> people need to sign your petition for us to check it. -<%= Site.threshold_for_moderation %> people need to click the link and confirm their support for us to check your petition. +Share your petition with your potential supporters, or send them the information at the bottom of this email. +<%= new_petition_sponsor_url(@petition, token: @petition.sponsor_token) %> -<% if moderation_delay? %> -Once you’ve gained the required number of supporters, we’ll check your petition to make sure it meets the petition standards. If it does, we’ll publish it. <%= moderation_delay_message %> -<% elsif christmas_period? %> -Once you’ve gained the required number of supporters, we’ll check your petition to make sure it meets the petition standards. If it does, we’ll publish it. This usually takes a week or less but over the Christmas period it will take us a little longer than usual. We’ll check your petition as quickly as we can. -<% elsif easter_period? %> -Once you’ve gained the required number of supporters, we’ll check your petition to make sure it meets the petition standards. If it does, we’ll publish it. This usually takes a week or less but over the Easter period it will take us a little longer than usual. We’ll check your petition as quickly as we can. -<% else %> -Once you’ve gained the required number of supporters, we’ll check your petition to make sure it meets the petition standards. If it does, we’ll publish it. This usually takes a week or less. -<% end %> +Once you’ve gained <%= number_to_word(Site.threshold_for_moderation) %> signatures, we’ll check your petition to make sure it meets the petition standards. If it does, we’ll publish it. If it doesn’t, we’ll let you know why. -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. +This can take up to 10 working days. Thank you for your patience. -<%= render "footer" %> +Up to <%= Site.maximum_number_of_sponsors %> people can sign your petition while we are checking it. Please wait until it’s been checked and published before sharing it more widely. +<%= render "footer" %> -- -I've made a petition – will you sign it? +I want to start a petition – will you sign it? -Click this link to sign the petition: +Sign the petition: <%= new_petition_sponsor_url(@petition, token: @petition.sponsor_token) %> -My petition: - <%= @petition.action %> <%= @petition.background %> @@ -37,7 +34,5 @@ My petition: <%= @petition.additional_details %> <% end %> --- - -Click this link to sign the petition: +Sign the petition: <%= new_petition_sponsor_url(@petition, token: @petition.sponsor_token) %> 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 ef926c9ed..896b5f8b6 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,13 +1,23 @@ <%= render "reason" %>

Dear <%= @signature.name %>,

-

Parliament is going to debate your petition – “<%= @petition.action %>”.

- -

<%= link_to nil, petition_url(@petition) %>

+

MPs are going to debate your petition – “<%= link_to @petition.action, 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/petition_mailer/notify_creator_of_debate_scheduled.text.erb b/app/views/petition_mailer/notify_creator_of_debate_scheduled.text.erb index 3a5662c89..a22e4d76c 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,13 +1,28 @@ <%= render "reason" %> Dear <%= @signature.name %>, -Parliament is going to debate your petition – “<%= @petition.action %>”. - -<%= 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/petition_mailer/notify_creator_of_threshold_response.html.erb b/app/views/petition_mailer/notify_creator_of_threshold_response.html.erb index 5a5da96e9..14c5b7cf0 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,25 +1,13 @@ <%= render "reason" %>

Dear <%= @signature.name %>,

-

The Government has responded to your petition – “<%= link_to @petition.action, petition_url(@petition) %>”.

- -

Government responded:

+The <%= link_to "Government has responded", 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, 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: <%= 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/petition_mailer/notify_creator_of_threshold_response.text.erb b/app/views/petition_mailer/notify_creator_of_threshold_response.text.erb index 4deb5e338..05827c6df 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,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 %>”. +<%= petition_url(@petition, reveal_response: "yes") %> <%= h(@government_response.summary) %> <%= h(@government_response.details) %> -Click this link to view the response online: - -<%= 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/petition_mailer/notify_creator_that_petition_is_published.html.erb b/app/views/petition_mailer/notify_creator_that_petition_is_published.html.erb index 14dbbfa26..b5fb910e8 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 @@ -1,8 +1,22 @@

Dear <%= @signature.name %>,

-

We published the petition you created – “<%= @petition.action %>”

+

We published the petition you created: “<%= link_to @petition.action, petition_url(@petition) %>”.

-

Click this link to see your petition and start sharing it:
-<%= link_to nil, petition_url(@petition) %>

+

<%= link_to "View the petition", petition_url(@petition) %>

+ +

It will be open for six months.

+ +

If 10,000 people sign this petition, the Government will respond.

+ +

If 100,000 people sign it, the Petitions Committee will consider whether MPs debate it in Parliament.

+ +

If you chose to receive updates about this petition, we’ll tell you if it receives a government response or will be debated.

+ +

We may also update you:

+ +
    +
  • if the topic is raised elsewhere in Parliament
  • +
  • about any opportunities to share your views of the topic with MPs or the Government.
  • +
<%= 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 6dc6d0349..a977493da 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 @@ -1,8 +1,22 @@ Dear <%= @signature.name %>, -We published the petition you created – “<%= @petition.action %>”. +We published the petition you created: “<%= @petition.action %>”. -Click this link to see your petition and start sharing it: +View the petition: <%= petition_url(@petition) %> +It will be open for six months. + +If 10,000 people sign this petition, the Government will respond. + +If 100,000 people sign it, the Petitions Committee will consider whether MPs debate it in Parliament. + +If you chose to receive updates about this petition, we’ll tell you if it receives a government response or will be debated. + +We may also update you: + +* if the topic is raised elsewhere in Parliament + +* about any opportunities to share your views of the topic with MPs or the Government. + <%= 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 ddd72a93b..63c59876d 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 @@ -1,22 +1,21 @@

Dear <%= @signature.name %>,

-

Sorry, we can’t accept your petition – “<%= @petition.action %>”. +<% if @petition.hidden? %> +

Sorry, we can’t accept your petition – “<%= @petition.action %>”.

+<% else %> +

Sorry, we can’t accept your petition – “<%= link_to @petition.action, petition_url(@petition) %>”.

+<% end %> <%= rejection_description(@rejection.code) %> <% if @rejection.details? -%>

<%= auto_link(h(@rejection.details)) %>

<% end -%> -<% unless @petition.hidden? -%> -

Click this link to see your rejected petition:
-<%= link_to 'View your rejected petition', petition_url(@petition) %>

-<% end -%> +

We can only accept petitions that meet the petition standards.

-

We only reject petitions that don’t meet the petition standards:
-<%= link_to nil, help_url(anchor: 'standards') %>

+

If you like, you can <%= link_to "start a new petition", check_petitions_url %>.

-

If you want to try again, click here to start a petition:
-<%= link_to nil, check_petitions_url %>

+

We understand that it can be disappointing when your petition cannot be accepted. There are also other ways to raise issues in Parliament.

<%= 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 436fd465b..8478cef96 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 @@ -1,22 +1,22 @@ Dear <%= @signature.name %>, -Sorry, we can’t accept your petition – "<%= @petition.action %>". - -<%= strip_tags(rejection_description(@rejection.code)) %> -<% if @rejection.details? -%> - -<%= @rejection.details %> -<% end -%> +Sorry, we can’t accept your petition – “<%= @petition.action %>”. <% unless @petition.hidden? -%> - -Click this link to see your rejected petition: <%= petition_url(@petition) %> <% end -%> -We only reject petitions that don’t meet the petition standards: -<%= help_url(anchor: 'standards') %> +<%= strip_tags(rejection_description(@rejection.code)) %> +<% if @rejection.details? %> -If you want to try again, click here to start a petition: +<%= @rejection.details %> +<% end %> +We can only accept petitions that meet the petition standards. + +If you like, you can start a new petition: <%= check_petitions_url %> +We understand that it can be disappointing when your petition cannot be accepted. +There are also other ways to raise issues in Parliament: +https://www.parliament.uk/get-involved/ + <%= render "footer" %> 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 d2932f293..28598e81f 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,13 +1,23 @@ <%= render "reason" %>

Dear <%= @signature.name %>,

-

Parliament is going to debate the petition you signed – “<%= @petition.action %>”.

- -

<%= link_to nil, petition_url(@petition) %>

+

MPs are going to debate the petition you signed: “<%= link_to @petition.action, 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/petition_mailer/notify_signer_of_debate_scheduled.text.erb b/app/views/petition_mailer/notify_signer_of_debate_scheduled.text.erb index 9f9ddc099..1d57cfe7f 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,13 +1,28 @@ <%= render "reason" %> Dear <%= @signature.name %>, -Parliament is going to debate the petition you signed – “<%= @petition.action %>”. - -<%= 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/petition_mailer/notify_signer_of_threshold_response.html.erb b/app/views/petition_mailer/notify_signer_of_threshold_response.html.erb index b361f4723..937c31bac 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,25 +1,13 @@ <%= render "reason" %>

Dear <%= @signature.name %>,

-

The Government has responded to the petition you signed – “<%= link_to @petition.action, 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, 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 %> +

<%= link_to "Read the full response", 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/petition_mailer/notify_signer_of_threshold_response.text.erb b/app/views/petition_mailer/notify_signer_of_threshold_response.text.erb index fa32e31e7..4597502bc 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,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: <%= 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 <%= 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/petition_mailer/notify_sponsor_that_petition_is_published.html.erb b/app/views/petition_mailer/notify_sponsor_that_petition_is_published.html.erb index 73ec3ce86..417ca35b5 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 @@ -1,8 +1,22 @@

Dear <%= @signature.name %>,

-

We published the petition you supported – “<%= @petition.action %>”

+

We published the petition you supported: “<%= link_to @petition.action, petition_url(@petition) %>”.

-

Click this link to see the petition and start sharing it:
-<%= link_to nil, petition_url(@petition) %>

+

It will be open for six months.

+ +

If 10,000 people sign this petition, the Government will respond.

+ +

If 100,000 people sign it, the Petitions Committee will consider whether MPs debate it in Parliament.

+ +

If you chose to receive updates about this petition, we’ll tell you if it receives a government response or will be debated.

+ +

We may also update you:

+ +
    +
  • if the topic is raised elsewhere in Parliament
  • +
  • about any opportunities to share your views of the topic with MPs or the Government.
  • +
+ +

<%= link_to "View the petition", petition_url(@petition) %>

<%= 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 0266dc453..dafb93efe 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 @@ -1,8 +1,22 @@ Dear <%= @signature.name %>, -We published the petition you supported – “<%= @petition.action %>”. +We published the petition you supported: “<%= @petition.action %>”. -Click this link to see the petition and start sharing it: +It will be open for six months. + +If 10,000 people sign this petition, the Government will respond. + +If 100,000 people sign it, the Petitions Committee will consider whether MPs debate it in Parliament. + +If you chose to receive updates about this petition, we’ll tell you if it receives a government response or will be debated. + +We may also update you: + +* if the topic is raised elsewhere in Parliament + +* about any opportunities to share your views of the topic with MPs or the Government. + +View the petition: <%= petition_url(@petition) %> <%= 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 c128112c1..9b5470494 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 @@ -1,19 +1,17 @@

Dear <%= @signature.name %>,

-

Sorry, we can’t accept the petition you supported – “<%= @petition.action %>”. +<% if @petition.hidden? %> +

Sorry, we can’t accept the petition you supported: “<%= @petition.action %>”. +<% else %> +

Sorry, we can’t accept the petition you supported: “<%= link_to @petition.action, petition_url(@petition) %>”. +<% end %> <%= rejection_description(@rejection.code) %> <% if @rejection.details? -%>

<%= auto_link(h(@rejection.details)) %>

<% end -%> -<% unless @petition.hidden? -%> -

Click this link to see the rejected petition:
-<%= link_to 'View the rejected petition', petition_url(@petition) %>

-<% end -%> - -

We only reject petitions that don’t meet the petition standards:
-<%= link_to nil, help_url(anchor: 'standards') %>

+

We only accept petitions that meet the <%= link_to "petition standards", help_url(anchor: 'standards') %>.

<%= 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 b7f20d2bb..ce48a6cdb 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 @@ -1,19 +1,16 @@ Dear <%= @signature.name %>, -Sorry, we can’t accept the petition you supported – "<%= @petition.action %>". - -<%= strip_tags(rejection_description(@rejection.code)) %> -<% if @rejection.details? -%> - -<%= @rejection.details %> -<% end -%> +Sorry, we can’t accept the petition you supported: “<%= @petition.action %>”. <% unless @petition.hidden? -%> - -Click this link to see the rejected petition: <%= petition_url(@petition) %> <% end -%> -We only reject petitions that don’t meet the petition standards: +<%= strip_tags(rejection_description(@rejection.code)) %> +<% if @rejection.details? %> + +<%= @rejection.details %> +<% end %> +We only accept petitions that meet the petition standards: <%= help_url(anchor: 'standards') %> <%= render "footer" %> diff --git a/app/views/sponsor_mailer/petition_and_email_confirmation_for_sponsor.html.erb b/app/views/sponsor_mailer/petition_and_email_confirmation_for_sponsor.html.erb index 72b488a99..880b5e376 100644 --- a/app/views/sponsor_mailer/petition_and_email_confirmation_for_sponsor.html.erb +++ b/app/views/sponsor_mailer/petition_and_email_confirmation_for_sponsor.html.erb @@ -1,20 +1,15 @@ -

Click this link to sign the petition “<%= @petition.action %>”

+

Dear <%= @sponsor.name %>,

-

<%= link_to nil, verify_sponsor_url(@sponsor, token: @sponsor.perishable_token) %>

+

Please <%= link_to "confirm your email", verify_sponsor_url(@sponsor, token: @sponsor.perishable_token) %> to support and sign <%= @petition.creator.name %>’s petition:

-
- -

<%= @petition.creator.name %>’s petition:

+

<%= @petition.action %>

-

<%= @petition.background %>

<% unless @petition.additional_details.blank? %> -

<%= @petition.additional_details %>

<% end %> -
+
-

Click this link to sign the petition:
-<%= link_to nil, verify_sponsor_url(@sponsor, token: @sponsor.perishable_token) %>

+<%= render "footer" %> diff --git a/app/views/sponsor_mailer/petition_and_email_confirmation_for_sponsor.text.erb b/app/views/sponsor_mailer/petition_and_email_confirmation_for_sponsor.text.erb index 1ef0a612b..b4e829608 100644 --- a/app/views/sponsor_mailer/petition_and_email_confirmation_for_sponsor.text.erb +++ b/app/views/sponsor_mailer/petition_and_email_confirmation_for_sponsor.text.erb @@ -1,10 +1,11 @@ -Click this link to sign the petition "<%= @petition.action %>" +Dear <%= @sponsor.name %>, +Please confirm your email: <%= verify_sponsor_url(@sponsor, token: @sponsor.perishable_token) %> --- +to support and sign <%= @petition.creator.name %>’s petition: -<%= @petition.creator.name %>’s petition: +-- <%= @petition.action %> @@ -16,5 +17,4 @@ Click this link to sign the petition "<%= @petition.action %>" -- -Click this link to sign the petition: -<%= verify_sponsor_url(@sponsor, token: @sponsor.perishable_token) %> +<%= 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 78081fdab..51dd0249b 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 @@ -1,10 +1,11 @@

Dear <%= @petition.creator.name %>,

-

<%= @sponsor.name %> supported your petition – “<%= @petition.action %>”.

+

Someone supported your petition: “<%= link_to @petition.action, petition_url(@petition) %>”.

-

You have <%= pluralize(@sponsor_count, 'supporter', locale: :en) %> so far. If <%= Site.threshold_for_moderation %> people support your petition we’ll check it to make sure it meets the petition standards. If it does, we’ll publish it.

+

You have <%= pluralize(@sponsor_count, "supporter", locale: :en) %> so far.

-

Find out how we check petitions before we publish them:
-<%= link_to nil, help_url(anchor: 'standards') %>

+

If <%= number_to_word(Site.threshold_for_moderation) %> people support your petition, we’ll check it to make sure it meets the <%= link_to "petition standards", help_url(anchor: 'standards') %>. + +

If it does, we’ll publish it. If it doesn’t, we’ll let you know why.

<%= 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 9de098bc6..ff3f864fc 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 @@ -1,10 +1,13 @@ Dear <%= @petition.creator.name %>, -<%= @sponsor.name %> supported your petition – "<%= @petition.action %>". +Someone supported your petition: “<%= @petition.action %>”. +<%= petition_url(@petition) %> -You have <%= pluralize(@sponsor_count, 'supporter', locale: :en) %> so far. If <%= Site.threshold_for_moderation %> people support your petition we’ll check it to make sure it meets the petition standards. If it does, we’ll publish it. +You have <%= pluralize(@sponsor_count, "supporter", locale: :en) %> so far. -Find out how we check petitions before we publish them: +If <%= number_to_word(Site.threshold_for_moderation) %> people support your petition, we’ll check it to make sure it meets the petition standards: <%= help_url(anchor: 'standards') %> +If it does, we’ll publish it. If it doesn’t, we’ll let you know why. + <%= 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 96efca76a..eb8ecdb09 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 @@ -1,22 +1,16 @@

Dear <%= @petition.creator.name %>,

-

Your petition is nearly ready to go.

- -

<%= @sponsor.name %> supported your petition – “<%= @petition.action %>”.

+

Someone supported your petition: “<%= link_to @petition.action, petition_url(@petition) %>”.

<% if moderation_delay? %> -

<%= @sponsor_count %> people have supported your petition so far. We’re checking your petition to make sure it meets the petition standards. If it does, we’ll publish it. <%= moderation_delay_message %>

-<% elsif christmas_period? %> -

<%= @sponsor_count %> people have supported your petition so far. We’re checking your petition to make sure it meets the petition standards. If it does, we’ll publish it. This usually takes a week or less but over the Christmas period it will take us a little longer than usual. We’ll check your petition as quickly as we can.

-<% elsif easter_period? %> -

<%= @sponsor_count %> people have supported your petition so far. We’re checking your petition to make sure it meets the petition standards. If it does, we’ll publish it. This usually takes a week or less but over the Easter period it will take us a little longer than usual. We’ll check your petition as quickly as we can.

+

<%= pluralize(@sponsor_count, "person", locale: :en) %> have supported your petition. We’re checking it to make sure it meets the <%= link_to "petition standards", help_url(anchor: 'standards') %>. If it does, we’ll publish it. If it doesn’t, we’ll let you know why.

+

We currently have a very large number of petitions to check, so it may take longer than 10 working days to check your petition. Thank you for your patience.

<% else %> -

<%= @sponsor_count %> people have supported your petition so far. We’re checking your petition to make sure it meets the petition standards. If it does, we’ll publish it. This usually takes a week or less.

+

<%= pluralize(@sponsor_count, "person", locale: :en) %> have supported your petition.

+

We’re checking it to make sure it meets the <%= link_to "petition standards", help_url(anchor: 'standards') %>.

+

If it does, we’ll publish it. If it doesn’t, we’ll let you know why.

<% end %> -

Once your petition has <%= Site.maximum_number_of_signatures %> signatures it won’t be able to add more until it’s been checked. So, please wait until it’s been checked and published before sharing it with lots more people.

- -

Find out how we check petitions before we publish them:
-<%= link_to nil, help_url(anchor: 'standards') %>

+

Once your petition has <%= Site.maximum_number_of_sponsors %> supporters, no one else will be able to sign it until it’s been checked. Please wait until it’s been checked and published before sharing more widely.

<%= 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 0425cd461..3b8f85a25 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 @@ -1,22 +1,22 @@ Dear <%= @petition.creator.name %>, -Your petition is nearly ready to go. +Someone supported your petition: “[<%= @petition.action %>][1]”. -<%= @sponsor.name %> supported your petition – "<%= @petition.action %>". +<% if moderation_delay? -%> +<%= pluralize(@sponsor_count, "person", locale: :en) %> have supported your petition. We’re checking it to make sure it meets the [petition standards][2]. If it does, we’ll publish it. If it doesn’t, we’ll let you know why. -<% if moderation_delay? %> -<%= @sponsor_count %> people have supported your petition so far. We’re checking your petition to make sure it meets the petition standards. If it does, we’ll publish it. <%= moderation_delay_message %> -<% elsif christmas_period? %> -<%= @sponsor_count %> people have supported your petition so far. We’re checking your petition to make sure it meets the petition standards. If it does, we’ll publish it. This usually takes a week or less but over the Christmas period it will take us a little longer than usual. We’ll check your petition as quickly as we can. -<% elsif easter_period? %> -<%= @sponsor_count %> people have supported your petition so far. We’re checking your petition to make sure it meets the petition standards. If it does, we’ll publish it. This usually takes a week or less but over the Easter period it will take us a little longer than usual. We’ll check your petition as quickly as we can. -<% else %> -<%= @sponsor_count %> people have supported your petition so far. We’re checking your petition to make sure it meets the petition standards. If it does, we’ll publish it. This usually takes a week or less. -<% end %> +We currently have a very large number of petitions to check, so it may take longer than 10 working days to check your petition. Thank you for your patience. +<% else -%> +<%= pluralize(@sponsor_count, "person", locale: :en) %> have supported your petition. -Once your petition has <%= Site.maximum_number_of_signatures %> signatures it won’t be able to add more until it’s been checked. So, please wait until it’s been checked and published before sharing it with lots more people. +We’re checking it to make sure it meets the [petition standards][2]. -Find out how we check petitions before we publish them: -<%= help_url(anchor: 'standards') %> +If it does, we’ll publish it. If it doesn’t, we’ll let you know why. +<% end -%> + +Once your petition has <%= Site.maximum_number_of_sponsors %> supporters, no one else will be able to sign it until it’s been checked. Please wait until it’s been checked and published before sharing more widely. + +[1]: <%= petition_url(@petition) %> +[2]: <%= help_url(anchor: 'standards') %> <%= render "footer" %> diff --git a/config/locales/petitions.en-GB.yml b/config/locales/petitions.en-GB.yml index 5ee98eed5..90b737ca3 100644 --- a/config/locales/petitions.en-GB.yml +++ b/config/locales/petitions.en-GB.yml @@ -151,19 +151,19 @@ en-GB: email_signer: |- %{subject} email_confirmation_for_signer: |- - Please confirm your email address + Confirm your email to sign “%{action}” email_duplicate_signatures: |- - Duplicate signature of petition + You have tried to sign this petition twice: “%{action}” mailshot_for_signer: |- %{subject} notify_signer_of_positive_debate_outcome: |- - Parliament debated “%{action}” + MPs debated the petition “%{action}” notify_signer_of_negative_debate_outcome: |- - Parliament didn’t debate “%{action}” + MPs will not debate the petition “%{action}” notify_signer_of_debate_scheduled: |- - Parliament will debate “%{action}” + MPs will debate “%{action}” notify_signer_of_threshold_response: |- - Government responded to “%{action}” + Government response: “%{action}” # Emails to people who create petitions email_creator: |- @@ -171,13 +171,13 @@ en-GB: mailshot_for_creator: |- %{subject} notify_creator_of_positive_debate_outcome: |- - Parliament debated “%{action}” + Your petition was debated: “%{action}” notify_creator_of_negative_debate_outcome: |- - Parliament didn’t debate “%{action}” + Your petition will not be debated: “%{action}” notify_creator_of_debate_scheduled: |- - Parliament will debate “%{action}” + Debate on your petition: “%{action}” notify_creator_of_threshold_response: |- - Government responded to “%{action}” + Government response: “%{action}” notify_creator_that_moderation_is_delayed: |- %{subject} privacy_policy_update_email: |- @@ -185,35 +185,35 @@ en-GB: # Emails to people who support a petition gather_sponsors_for_petition: |- - Action required: Petition “%{action}” + Get supporters for: “%{action}” notify_creator_that_petition_is_published: |- - We published your petition “%{action}” + Your petition is live: “%{action}” notify_sponsor_that_petition_is_published: |- - We published the petition “%{action}” that you supported + We published “%{action}” notify_creator_that_petition_was_rejected: |- - We rejected your petition “%{action}” + Petition not accepted: “%{action}” notify_sponsor_that_petition_was_rejected: |- - We rejected the petition “%{action}” that you supported + Petition not accepted: “%{action}” petition_and_email_confirmation_for_sponsor: |- - Please confirm your email address + Sign to support: “%{action}” sponsor_signed_email_below_threshold: |- - %{name} supported your petition + Someone supported: “%{action}” sponsor_signed_email_on_threshold: |- - We’re checking your petition + Your petition has %{threshold} supporters: “%{action}” # Re-send confirmation emails special_resend_of_email_confirmation_for_signer: |- - Please confirm your email address + Confirm your email to sign “%{action}” notify_creator_of_closing_date_change: - one: We’re closing your petition early - other: We’re closing your petitions early + one: "General Election: your petition is closing" + other: "General Election: your petitions are closing" notify_signer_of_closing_date_change: - one: We’re closing petitions early - other: We’re closing petitions early + one: "General Election: all petitions to close" + other: "General Election: all petitions to close" notify_creator_of_sponsored_petition_being_stopped: |- - We’ve stopped your petition early + General Election: petitions website closing notify_creator_of_validated_petition_being_stopped: |- - We’ve stopped your petition early + General Election: petitions website closing signoff_prefix: "The Petitions Team" signoff_suffix: "House of Commons" diff --git a/features/laura_signs_charlies_petition_as_a_sponsor.feature b/features/laura_signs_charlies_petition_as_a_sponsor.feature index 054ac8b62..54f5e71ae 100644 --- a/features/laura_signs_charlies_petition_as_a_sponsor.feature +++ b/features/laura_signs_charlies_petition_as_a_sponsor.feature @@ -15,7 +15,7 @@ Feature: As Laura, a sponsor of my friend Charlie's petition When I say I am happy with my email address Then I should have a pending signature on the petition as a sponsor And I should receive an email explaining the petition I am sponsoring - When I confirm my email address + When I confirm my email address as a sponsor Then I should see a heading called "Thanks" And I should have fully signed the petition as a sponsor @@ -78,11 +78,11 @@ Feature: As Laura, a sponsor of my friend Charlie's petition Scenario: Laura sees notice that she has already signed when she validates more than once When I have sponsored a petition - When I confirm my email address + When I confirm my email address as a sponsor Then I should see a heading called "Thanks" And I should see "Your signature has been added to this petition as a supporter" And I should have fully signed the petition as a sponsor - When I confirm my email address again + When I confirm my email address as a sponsor again Then I should see a heading called "Thanks" And I should see "Your signature has been added to this petition as a supporter" And I should see /This petition needs [0-9]+ supporters to go live/ diff --git a/features/sam_signs_a_petition_with_suzies_email_address.feature b/features/sam_signs_a_petition_with_suzies_email_address.feature index d56008f56..0afc40289 100644 --- a/features/sam_signs_a_petition_with_suzies_email_address.feature +++ b/features/sam_signs_a_petition_with_suzies_email_address.feature @@ -13,13 +13,13 @@ Feature: Sam signs a petition Scenario: Sam cannot sign the petition again using Suzie's name When I try to sign the petition with the same email address and the same name - Then "womboid@wimbledon.com" should receive an email with subject "Duplicate signature of petition" + Then "womboid@wimbledon.com" should receive an email with subject "You have tried to sign this petition twice" Scenario: Sam cannot sign the petition with a different postcode When I try to sign the petition with the same email address, a different name, and a different postcode - Then "womboid@wimbledon.com" should receive an email with subject "Duplicate signature of petition" + Then "womboid@wimbledon.com" should receive an email with subject "You have tried to sign this petition twice" Scenario: Sarah (Sam's daughter) cannot sign the petition a third time with the same email address Given I have signed the petition with a second name When I try to sign the petition with the same email address and a third name - Then "womboid@wimbledon.com" should receive an email with subject "Duplicate signature of petition" + Then "womboid@wimbledon.com" should receive an email with subject "You have tried to sign this petition twice" diff --git a/features/step_definitions/debate_scheduled_steps.rb b/features/step_definitions/debate_scheduled_steps.rb index e7c90ef31..36223e6fb 100644 --- a/features/step_definitions/debate_scheduled_steps.rb +++ b/features/step_definitions/debate_scheduled_steps.rb @@ -3,7 +3,7 @@ steps %Q( Then "#{@petition.creator.email}" should receive an email When they open the email - Then they should see "Parliament is going to debate your petition" in the email body + Then they should see "MPs are going to debate your petition" in the email body When they click the second link in the email Then I should be on the petition page for "#{@petition.action}" ) @@ -15,7 +15,7 @@ steps %Q( Then "#{signatory.email}" should receive an email When they open the email - Then they should see "Parliament is going to debate the petition" in the email body + Then they should see "MPs are going to debate the petition" in the email body When they click the second link in the email Then I should be on the petition page for "#{@petition.action}" ) diff --git a/features/step_definitions/moderation_steps.rb b/features/step_definitions/moderation_steps.rb index 37256e133..da7842ad9 100644 --- a/features/step_definitions/moderation_steps.rb +++ b/features/step_definitions/moderation_steps.rb @@ -132,7 +132,7 @@ Then "#{@petition.creator.email}" should receive an email When they open the email Then they should see "published" in the email body - And they should see /We published your petition/ in the email subject + And they should see /Your petition is live/ in the email subject ) end @@ -147,7 +147,7 @@ When they open the email Then they should see "Sorry, we can’t accept your petition" in the email body And they should see "#{strip_tags(rejection_description(@petition.rejection.code)).split("\n").first}" in the email body - And they should see /We rejected your petition/ in the email subject + And they should see /Petition not accepted/ in the email subject ) if petition_is_libellous step %{they should not see "#{petition_url(@petition)}" in the email body} diff --git a/features/step_definitions/signature_steps.rb b/features/step_definitions/signature_steps.rb index e9c066abc..f7232a54c 100644 --- a/features/step_definitions/signature_steps.rb +++ b/features/step_definitions/signature_steps.rb @@ -22,7 +22,14 @@ When(/^I confirm my email address(?: again)?$/) do steps %Q( - And I open the email with subject "Please confirm your email address" + And I open the email with subject "Confirm your email to sign" + When I click the first link in the email + ) +end + +When(/^I confirm my email address as a sponsor(?: again)?$/) do + steps %Q( + And I open the email with subject "Sign to support:" When I click the first link in the email ) end diff --git a/features/step_definitions/sponsor_steps.rb b/features/step_definitions/sponsor_steps.rb index 7d5c4b1f8..a2084bf19 100644 --- a/features/step_definitions/sponsor_steps.rb +++ b/features/step_definitions/sponsor_steps.rb @@ -27,7 +27,7 @@ And I select "United Kingdom" from "Location" And I try to sign And I say I am happy with my email address - And "#{sponsor_email}" opens the email with subject "Please confirm your email address" + And "#{sponsor_email}" opens the email with subject "Sign to support: “#{@sponsor_petition.action}”" And they click the first link in the email } signature = @sponsor_petition.signatures.for_email(sponsor_email).first @@ -39,7 +39,7 @@ deliveries.delete_if { |email| email.to == %w[charlie.the.creator@example.com] } steps %{ - And "laura.the.sponsor@example.com" opens the email with subject "Please confirm your email address" + And "laura.the.sponsor@example.com" opens the email with subject "Sign to support: “#{@sponsor_petition.action}”" And they click the first link in the email } end @@ -146,7 +146,7 @@ expect(unread_emails_for(address).size).to eq 1 open_last_email_for(address) steps %{ - Then they should see "Please confirm your email address" in the email subject + Then they should see "Sign to support: “#{@sponsor_petition.action}”" in the email subject And they should see "#{@sponsor_petition.action}" in the email body And they should see "#{@sponsor_petition.background}" in the email body And they should see "#{@sponsor_petition.additional_details}" in the email body @@ -160,8 +160,8 @@ Then(/^(I|they|".*?") should be emailed a link for gathering support from sponsors$/) do |address| steps %{ - Then #{address} should receive an email with subject "Action required: Petition" - When they open the email with subject "Action required: Petition" + Then #{address} should receive an email with subject "Get supporters for:" + When they open the email with subject "Get supporters for:" Then they should see /\/petitions\/\\d+\/sponsors\/[A-Za-z0-9]+/ in the email body } end diff --git a/features/step_definitions/sponsor_support_nofitication_steps.rb b/features/step_definitions/sponsor_support_nofitication_steps.rb index a5e1d2ab5..ee60024bf 100644 --- a/features/step_definitions/sponsor_support_nofitication_steps.rb +++ b/features/step_definitions/sponsor_support_nofitication_steps.rb @@ -1,24 +1,24 @@ Then(/^I should receive a sponsor support notification email$/) do - step %{"charlie.the.creator@example.com" should receive an email with subject "supported your petition"} + step %{"charlie.the.creator@example.com" should receive an email with subject "Someone supported: “#{@sponsor_petition.action}”"} end Then(/^I should not receive a sponsor support notification email$/) do - step %{"charlie.the.creator@example.com" should receive no email with subject "supported your petition"} + step %{"charlie.the.creator@example.com" should receive no email with subject "Someone supported: “#{@sponsor_petition.action}”"} end Then(/^I should receive a sponsor threshold notification email$/) do - step %{"charlie.the.creator@example.com" should receive an email with subject "We’re checking your petition"} + step %{"charlie.the.creator@example.com" should receive an email with subject "Your petition has five supporters: “#{@sponsor_petition.action}”"} end Then(/^I should not receive a sponsor threshold notification email$/) do - step %{"charlie.the.creator@example.com" should receive no email with subject "We’re checking your petition"} + step %{"charlie.the.creator@example.com" should receive no email with subject "Your petition has five supporters: “#{@sponsor_petition.action}”"} end Then(/^the sponsor support notification email should include the countdown to the threshold$/) do signed = @sponsor_petition.sponsors.validated.count threshold = Site.threshold_for_moderation email = open_last_email_for("charlie.the.creator@example.com") - expect(email.subject).to match /supported your petition/ + expect(email.subject).to match /Someone supported/ mail_body = email.default_part_body.to_s expect(mail_body).to include "You have #{signed} #{'supporter'.pluralize(signed)} so far" end @@ -27,8 +27,7 @@ threshold = Site.threshold_for_moderation email = open_last_email_for("charlie.the.creator@example.com") - expect(email.subject).to match /We’re checking your petition/ + expect(email.subject).to match /Your petition has five supporters/ mail_body = email.default_part_body.to_s - expect(mail_body).to include "#{threshold} people have supported your petition so far" - expect(mail_body).not_to match /support from \d+ of your nominated sponsors/ + expect(mail_body).to include "#{threshold} people have supported your petition" end diff --git a/features/suzie_signs_a_petition.feature b/features/suzie_signs_a_petition.feature index 276fc3b04..b2a78c482 100644 --- a/features/suzie_signs_a_petition.feature +++ b/features/suzie_signs_a_petition.feature @@ -76,7 +76,7 @@ Feature: Suzie signs a petition And I fill in my details And I try to sign And I say I am happy with my email address - Then "WOMBOID@wimbledon.com" should receive 1 email with subject "Duplicate signature of petition" + Then "WOMBOID@wimbledon.com" should receive 1 email with subject "You have tried to sign this petition twice" Scenario: Suzie receives a duplicate signature email if she changes to her original email but she has already signed and validated When I have already signed the petition with an uppercase email @@ -85,7 +85,7 @@ Feature: Suzie signs a petition And I try to sign When I change my email address to "womboid@wimbledon.com" And I say I am happy with my email address - Then "WOMBOID@wimbledon.com" should receive 1 email with subject "Duplicate signature of petition" + Then "WOMBOID@wimbledon.com" should receive 1 email with subject "You have tried to sign this petition twice" Scenario: Suzie receives a duplicate signature email if an alias has been used to sign the petition already Given "wimbledon.com" is configured to normalize email address @@ -94,7 +94,7 @@ Feature: Suzie signs a petition And I fill in my details with postcode "N1 1TY" And I try to sign And I say I am happy with my email address - Then "wom.boid@wimbledon.com" should receive 1 email with subject "Duplicate signature of petition" + Then "wom.boid@wimbledon.com" should receive 1 email with subject "You have tried to sign this petition twice" Scenario: Suzie receives another email if she has already signed but not validated When I have already signed the petition but not validated my email diff --git a/spec/controllers/admin/archived/government_response_controller_spec.rb b/spec/controllers/admin/archived/government_response_controller_spec.rb index decfeca3a..017417439 100644 --- a/spec/controllers/admin/archived/government_response_controller_spec.rb +++ b/spec/controllers/admin/archived/government_response_controller_spec.rb @@ -211,10 +211,10 @@ def do_patch(overrides = {}) ['laura_1@example.com'], ['laura_2@example.com'] ]) - expect(ActionMailer::Base.deliveries[0].subject).to match(/Government responded to “#{petition.action}”/) - expect(ActionMailer::Base.deliveries[1].subject).to match(/Government responded to “#{petition.action}”/) - expect(ActionMailer::Base.deliveries[2].subject).to match(/Government responded to “#{petition.action}”/) - expect(ActionMailer::Base.deliveries[3].subject).to match(/Government responded to “#{petition.action}”/) + expect(ActionMailer::Base.deliveries[0].subject).to match(/Government response: “#{petition.action}”/) + expect(ActionMailer::Base.deliveries[1].subject).to match(/Government response: “#{petition.action}”/) + expect(ActionMailer::Base.deliveries[2].subject).to match(/Government response: “#{petition.action}”/) + expect(ActionMailer::Base.deliveries[3].subject).to match(/Government response: “#{petition.action}”/) end end end diff --git a/spec/controllers/admin/government_response_controller_spec.rb b/spec/controllers/admin/government_response_controller_spec.rb index 344ee3f58..0b7c673b7 100644 --- a/spec/controllers/admin/government_response_controller_spec.rb +++ b/spec/controllers/admin/government_response_controller_spec.rb @@ -220,10 +220,10 @@ def do_patch(overrides = {}) ['laura_1@example.com'], ['laura_2@example.com'] ]) - expect(ActionMailer::Base.deliveries[0].subject).to match(/Government responded to “#{petition.action}”/) - expect(ActionMailer::Base.deliveries[1].subject).to match(/Government responded to “#{petition.action}”/) - expect(ActionMailer::Base.deliveries[2].subject).to match(/Government responded to “#{petition.action}”/) - expect(ActionMailer::Base.deliveries[3].subject).to match(/Government responded to “#{petition.action}”/) + expect(ActionMailer::Base.deliveries[0].subject).to match(/Government response: “#{petition.action}”/) + expect(ActionMailer::Base.deliveries[1].subject).to match(/Government response: “#{petition.action}”/) + expect(ActionMailer::Base.deliveries[2].subject).to match(/Government response: “#{petition.action}”/) + expect(ActionMailer::Base.deliveries[3].subject).to match(/Government response: “#{petition.action}”/) end end end diff --git a/spec/controllers/admin/moderation_controller_spec.rb b/spec/controllers/admin/moderation_controller_spec.rb index 4f673bf6b..88452e565 100644 --- a/spec/controllers/admin/moderation_controller_spec.rb +++ b/spec/controllers/admin/moderation_controller_spec.rb @@ -122,12 +122,12 @@ def do_patch(options = patch_options) it "sends an email to the petition creator" do expect(creator_email).to deliver_to("bazbutler@gmail.com") - expect(creator_email).to have_subject(/We published your petition “[^"]+”/) + expect(creator_email).to have_subject(/Your petition is live: “[^"]+”/) end it "sends an email to validated petition sponsors" do expect(sponsor_email).to deliver_to("laurapalmer@gmail.com") - expect(sponsor_email).to have_subject(/We published the petition “[^"]+” that you supported/) + expect(sponsor_email).to have_subject(/We published “[^"]+”/) end it "doesn't send an email to pending petition sponsors" do @@ -186,12 +186,12 @@ def do_patch(options = patch_options) it "sends an email to the petition creator" do expect(creator_email).to deliver_to("bazbutler@gmail.com") - expect(creator_email.subject).to match(/We rejected your petition “[^"]+”/) + expect(creator_email.subject).to match(/Petition not accepted: “[^"]+”/) end it "sends an email to validated petition sponsors" do expect(sponsor_email).to deliver_to("laurapalmer@gmail.com") - expect(sponsor_email.subject).to match(/We rejected the petition “[^"]+” that you supported/) + expect(sponsor_email.subject).to match(/Petition not accepted: “[^"]+”/) end it "does not send an email to pending petition sponsors" do @@ -230,12 +230,12 @@ def do_patch(options = patch_options) it "sends an email to the petition creator" do expect(creator_email).to deliver_to("bazbutler@gmail.com") - expect(creator_email.subject).to match(/We rejected your petition “[^"]+”/) + expect(creator_email.subject).to match(/Petition not accepted: “[^"]+”/) end it "sends an email to validated petition sponsors" do expect(sponsor_email).to deliver_to("laurapalmer@gmail.com") - expect(sponsor_email.subject).to match(/We rejected the petition “[^"]+” that you supported/) + expect(sponsor_email.subject).to match(/Petition not accepted: “[^"]+”/) end it "does not send an email to pending petition sponsors" do diff --git a/spec/controllers/admin/petitions_controller_spec.rb b/spec/controllers/admin/petitions_controller_spec.rb index 8fd4ba438..266191a10 100644 --- a/spec/controllers/admin/petitions_controller_spec.rb +++ b/spec/controllers/admin/petitions_controller_spec.rb @@ -120,11 +120,11 @@ end it "resends the email to the petition creator" do - expect(mailbox_for("bob@example.com").last).to have_subject("Action required: Petition “Do Stuff!”") + expect(mailbox_for("bob@example.com").last).to have_subject("Get supporters for: “Do Stuff!”") end it "sends a copy of the email to the feedback address" do - expect(mailbox_for("petitionscommittee@parliament.uk").last).to have_subject("Action required: Petition “Do Stuff!”") + expect(mailbox_for("petitionscommittee@parliament.uk").last).to have_subject("Get supporters for: “Do Stuff!”") end end end diff --git a/spec/controllers/admin/take_down_controller_spec.rb b/spec/controllers/admin/take_down_controller_spec.rb index e323d89b4..e64fb85a7 100644 --- a/spec/controllers/admin/take_down_controller_spec.rb +++ b/spec/controllers/admin/take_down_controller_spec.rb @@ -144,12 +144,12 @@ def do_patch(overrides = {}) it "sends an email to the petition creator" do expect(creator_email).to deliver_to("bazbutler@gmail.com") - expect(creator_email.subject).to match(/We rejected your petition “[^"]+”/) + expect(creator_email.subject).to match(/Petition not accepted: “[^"]+”/) end it "sends an email to validated petition sponsors" do expect(sponsor_email).to deliver_to("laurapalmer@gmail.com") - expect(sponsor_email.subject).to match(/We rejected the petition “[^"]+” that you supported/) + expect(sponsor_email.subject).to match(/Petition not accepted: “[^"]+”/) end it "does not send an email to pending petition sponsors" do @@ -185,12 +185,12 @@ def do_patch(overrides = {}) it "sends an email to the petition creator" do expect(creator_email).to deliver_to("bazbutler@gmail.com") - expect(creator_email.subject).to match(/We rejected your petition “[^"]+”/) + expect(creator_email.subject).to match(/Petition not accepted: “[^"]+”/) end it "sends an email to validated petition sponsors" do expect(sponsor_email).to deliver_to("laurapalmer@gmail.com") - expect(sponsor_email.subject).to match(/We rejected the petition “[^"]+” that you supported/) + expect(sponsor_email.subject).to match(/Petition not accepted: “[^"]+”/) end it "does not send an email to pending petition sponsors" do diff --git a/spec/controllers/petitions_controller_spec.rb b/spec/controllers/petitions_controller_spec.rb index 43a3690e3..791077c30 100644 --- a/spec/controllers/petitions_controller_spec.rb +++ b/spec/controllers/petitions_controller_spec.rb @@ -108,7 +108,7 @@ expect(last_email_sent).to deliver_to("john@example.com") expect(last_email_sent).to deliver_from(%{"Petitions: UK Government and Parliament" }) - expect(last_email_sent).to have_subject("Action required: Petition “Save the planet”") + expect(last_email_sent).to have_subject("Get supporters for: “Save the planet”") end it "should successfully point the signature at the petition" do diff --git a/spec/controllers/signatures_controller_spec.rb b/spec/controllers/signatures_controller_spec.rb index c3568fdb2..64a1f847a 100644 --- a/spec/controllers/signatures_controller_spec.rb +++ b/spec/controllers/signatures_controller_spec.rb @@ -351,7 +351,7 @@ it "sends a confirmation email" do expect(last_email_sent).to deliver_to("ted@example.com") - expect(last_email_sent).to have_subject("Please confirm your email address") + expect(last_email_sent).to have_subject("Confirm your email to sign “#{petition.action}”") end it "redirects to the thank you page" do @@ -394,7 +394,7 @@ it "re-sends the confirmation email" do expect(last_email_sent).to deliver_to("ted@example.com") - expect(last_email_sent).to have_subject("Please confirm your email address") + expect(last_email_sent).to have_subject("Confirm your email to sign “#{petition.action}”") end it "redirects to the thank you page" do @@ -423,7 +423,7 @@ it "re-sends the confirmation email" do expect(last_email_sent).to deliver_to("ted@example.com") - expect(last_email_sent).to have_subject("Please confirm your email address") + expect(last_email_sent).to have_subject("Confirm your email to sign “#{petition.action}”") end it "redirects to the thank you page" do @@ -450,7 +450,7 @@ it "sends a duplicate signature email" do expect(last_email_sent).to deliver_to("ted@example.com") - expect(last_email_sent).to have_subject("Duplicate signature of petition") + expect(last_email_sent).to have_subject(/You have tried to sign this petition twice: “[^”]+”/) end it "redirects to the thank you page" do @@ -479,7 +479,7 @@ it "sends a duplicate signature email" do expect(last_email_sent).to deliver_to("ted@example.com") - expect(last_email_sent).to have_subject("Duplicate signature of petition") + expect(last_email_sent).to have_subject(/You have tried to sign this petition twice: “[^”]+”/) end it "redirects to the thank you page" do diff --git a/spec/controllers/sponsors_controller_spec.rb b/spec/controllers/sponsors_controller_spec.rb index a9e6ecaa7..d97f7f6d1 100644 --- a/spec/controllers/sponsors_controller_spec.rb +++ b/spec/controllers/sponsors_controller_spec.rb @@ -354,7 +354,7 @@ it "sends a confirmation email" do expect(last_email_sent).to deliver_to("ted@example.com") - expect(last_email_sent).to have_subject("Please confirm your email address") + expect(last_email_sent).to have_subject("Sign to support: “#{petition.action}”") end it "redirects to the thank you page" do @@ -397,7 +397,7 @@ it "re-sends the confirmation email" do expect(last_email_sent).to deliver_to("ted@example.com") - expect(last_email_sent).to have_subject("Please confirm your email address") + expect(last_email_sent).to have_subject("Sign to support: “#{petition.action}”") end it "redirects to the thank you page" do @@ -426,7 +426,7 @@ it "re-sends the confirmation email" do expect(last_email_sent).to deliver_to("ted@example.com") - expect(last_email_sent).to have_subject("Please confirm your email address") + expect(last_email_sent).to have_subject("Sign to support: “#{petition.action}”") end it "redirects to the thank you page" do @@ -453,7 +453,7 @@ it "sends a duplicate signature email" do expect(last_email_sent).to deliver_to("ted@example.com") - expect(last_email_sent).to have_subject("Duplicate signature of petition") + expect(last_email_sent).to have_subject("You have tried to sign this petition twice: “#{petition.action}”") end it "redirects to the thank you page" do @@ -482,7 +482,7 @@ it "sends a duplicate signature email" do expect(last_email_sent).to deliver_to("ted@example.com") - expect(last_email_sent).to have_subject("Duplicate signature of petition") + expect(last_email_sent).to have_subject("You have tried to sign this petition twice: “#{petition.action}”") end it "redirects to the thank you page" do @@ -780,7 +780,7 @@ it "sends email notification to the petition creator" do expect(last_email_sent).to deliver_to("bob@example.com") - expect(last_email_sent).to have_subject("Alice supported your petition") + expect(last_email_sent).to have_subject("Someone supported: “#{petition.action}”") end it "redirects to the signed signature page" do @@ -854,7 +854,7 @@ it "sends email notification to the petition creator" do expect(last_email_sent).to deliver_to("bob@example.com") - expect(last_email_sent).to have_subject("Alice supported your petition") + expect(last_email_sent).to have_subject("Someone supported: “#{petition.action}”") end it "redirects to the signed signature page" do @@ -906,7 +906,7 @@ it "sends email notification to the petition creator" do expect(last_email_sent).to deliver_to("bob@example.com") - expect(last_email_sent).to have_subject("We’re checking your petition") + expect(last_email_sent).to have_subject("Your petition has five supporters: “#{petition.action}”") end it "redirects to the signed signature page" do @@ -939,7 +939,7 @@ it "sends email notification to the petition creator" do expect(last_email_sent).to deliver_to("bob@example.com") - expect(last_email_sent).to have_subject("We’re checking your petition") + expect(last_email_sent).to have_subject("Your petition has five supporters: “#{petition.action}”") end it "redirects to the signed signature page" do diff --git a/spec/mailers/archived/petition_mailer_spec.rb b/spec/mailers/archived/petition_mailer_spec.rb index bd9bb697b..2452a0bc2 100644 --- a/spec/mailers/archived/petition_mailer_spec.rb +++ b/spec/mailers/archived/petition_mailer_spec.rb @@ -53,40 +53,16 @@ end it "has the correct subject" do - expect(mail).to have_subject("Government responded to “Allow organic vegetable vans to use red diesel”") + expect(mail).to have_subject("Government response: “Allow organic vegetable vans to use red diesel”") end it "has response summary in the body" do expect(mail).to have_body_text("Sounds like a good idea") end - it "has response details in the body" do - expect(mail).to have_body_text("We’ll get right on that") - end - it "includes a link to read the response online" do expect(mail).to have_body_text(%r[https://petition.parliament.uk/archived/petitions/#{petition.id}\?reveal_response=yes]) end - - context "when the signature count is less than the debate threshold" do - let(:signature_count) { 12345 } - - it "includes a message about the committee's response" do - expect(mail).to have_body_text("The Petitions Committee will take a look at this petition and its response.") - expect(mail).to have_body_text("They can press the government for action and gather evidence.") - expect(mail).to have_body_text("If this petition reaches 100,000 signatures, the Committee will consider it for a debate.") - end - end - - context "when the signature count is more than the debate threshold" do - let(:signature_count) { 123456 } - - it "includes a message about the committee's response" do - expect(mail).to have_body_text("This petition has over 100,000 signatures.") - expect(mail).to have_body_text("The Petitions Committee will consider it for a debate.") - expect(mail).to have_body_text("They can also gather further evidence and press the government for action.") - end - end end context "when the signature is the creator" do @@ -105,8 +81,20 @@ expect(mail).to have_body_text("Dear Barry Butler,") end + it "has response details in the body" do + expect(mail).to have_body_text("We’ll get right on that") + end + it "has the message in the body" do - expect(mail).to have_body_text("The Government has responded to your petition") + expect(mail).to have_body_text("Government has responded") + end + + context "when the signature count is less than the debate threshold" do + let(:signature_count) { 12345 } + + it "includes a message about the committee's response" do + expect(mail).to have_body_text("If it reaches 100,000 signatures, the Petitions Committee will consider whether MPs debate it in the House of Commons.") + end end end @@ -126,9 +114,21 @@ expect(mail).to have_body_text("Dear Laura Palmer,") end + it "doesn't have response details in the body" do + expect(mail).not_to have_body_text("We’ll get right on that") + end + it "has the message in the body" do expect(mail).to have_body_text("The Government has responded to the petition you signed") end + + context "when the signature count is less than the debate threshold" do + let(:signature_count) { 12345 } + + it "includes a message about the committee's response" do + expect(mail).to have_body_text("If 100,000 people sign the petition, the Petitions Committee will consider whether MPs debate it in Parliament.") + end + end end end @@ -163,10 +163,6 @@ expect(mail).to have_header("List-Unsubscribe-Post", "List-Unsubscribe=One-Click") end - it "has the correct subject" do - expect(mail).to have_subject("Parliament will debate “Allow organic vegetable vans to use red diesel”") - end - it "has the scheduled debate date in the body" do expect(mail).to have_body_text("12 September 2017") end @@ -188,8 +184,12 @@ expect(mail).to have_body_text("Dear Barry Butler,") end + it "has the correct subject" do + expect(mail).to have_subject("Debate on your petition: “Allow organic vegetable vans to use red diesel”") + end + it "has the message in the body" do - expect(mail).to have_body_text("Parliament is going to debate your petition") + expect(mail).to have_body_text("MPs are going to debate your petition") end end @@ -209,8 +209,12 @@ expect(mail).to have_body_text("Dear Laura Palmer,") end + it "has the correct subject" do + expect(mail).to have_subject("MPs will debate “Allow organic vegetable vans to use red diesel”") + end + it "has the message in the body" do - expect(mail).to have_body_text("Parliament is going to debate the petition you signed") + expect(mail).to have_body_text("MPs are going to debate the petition you signed") end end end @@ -254,7 +258,7 @@ shared_examples_for "a positive debate outcome email" do it "has the correct subject" do - expect(mail).to have_subject("Parliament debated “Allow organic vegetable vans to use red diesel”") + expect(mail).to have_subject("Your petition was debated: “Allow organic vegetable vans to use red diesel”") end it "has the positive message in the body" do @@ -264,7 +268,7 @@ shared_examples_for "a negative debate outcome email" do it "has the correct subject" do - expect(mail).to have_subject('Parliament didn’t debate “Allow organic vegetable vans to use red diesel”') + expect(mail).to have_subject('Your petition will not be debated: “Allow organic vegetable vans to use red diesel”') end it "has the negative message in the body" do @@ -391,7 +395,7 @@ shared_examples_for "a positive debate outcome email" do it "has the correct subject" do - expect(mail).to have_subject("Parliament debated “Allow organic vegetable vans to use red diesel”") + expect(mail).to have_subject("MPs debated the petition “Allow organic vegetable vans to use red diesel”") end it "has the positive message in the body" do @@ -401,7 +405,7 @@ shared_examples_for "a negative debate outcome email" do it "has the correct subject" do - expect(mail).to have_subject("Parliament didn’t debate “Allow organic vegetable vans to use red diesel”") + expect(mail).to have_subject("MPs will not debate the petition “Allow organic vegetable vans to use red diesel”") end it "has the negative message in the body" do diff --git a/spec/mailers/petition_mailer_spec.rb b/spec/mailers/petition_mailer_spec.rb index 161491142..8eb551ea8 100644 --- a/spec/mailers/petition_mailer_spec.rb +++ b/spec/mailers/petition_mailer_spec.rb @@ -56,7 +56,7 @@ end it "has an appropriate subject heading" do - expect(mail).to have_subject('We published your petition “Allow organic vegetable vans to use red diesel”') + expect(mail).to have_subject('Your petition is live: “Allow organic vegetable vans to use red diesel”') end it "is addressed to the creator" do @@ -90,7 +90,7 @@ end it "has an appropriate subject heading" do - expect(mail).to have_subject('We published the petition “Allow organic vegetable vans to use red diesel” that you supported') + expect(mail).to have_subject('We published “Allow organic vegetable vans to use red diesel”') end it "is addressed to the sponsor" do @@ -118,7 +118,7 @@ end it "has an appropriate subject heading" do - expect(mail).to have_subject('We rejected your petition “Allow organic vegetable vans to use red diesel”') + expect(mail).to have_subject('Petition not accepted: “Allow organic vegetable vans to use red diesel”') end it "is addressed to the creator" do @@ -174,7 +174,7 @@ end it "has an appropriate subject heading" do - expect(mail).to have_subject('We rejected the petition “Allow organic vegetable vans to use red diesel” that you supported') + expect(mail).to have_subject('Petition not accepted: “Allow organic vegetable vans to use red diesel”') end it "is addressed to the sponsor" do @@ -224,7 +224,7 @@ end it "has an appropriate subject heading" do - expect(mail).to have_subject("We’re closing your petition early") + expect(mail).to have_subject("General Election: your petition is closing") end it "is addressed to the creator" do @@ -258,7 +258,7 @@ end it "has an appropriate subject heading" do - expect(mail).to have_subject("We’re closing petitions early") + expect(mail).to have_subject("General Election: all petitions to close") end it "is addressed to the creator" do @@ -285,7 +285,7 @@ end it "has an appropriate subject heading" do - expect(mail).to have_subject("We’ve stopped your petition early") + expect(mail).to have_subject("General Election: petitions website closing") end it "is addressed to the creator" do @@ -308,7 +308,7 @@ end it "has an appropriate subject heading" do - expect(mail).to have_subject("We’ve stopped your petition early") + expect(mail).to have_subject("General Election: petitions website closing") end it "is addressed to the creator" do @@ -334,7 +334,7 @@ subject(:mail) { described_class.gather_sponsors_for_petition(petition) } it "has the correct subject" do - expect(mail).to have_subject(%{Action required: Petition “Allow organic vegetable vans to use red diesel”}) + expect(mail).to have_subject(%{Get supporters for: “Allow organic vegetable vans to use red diesel”}) end it "has the addresses the creator by name" do @@ -364,118 +364,11 @@ end it "includes information about moderation" do - expect(mail).to have_body_text(%r[Once you’ve gained the required number of supporters]) + expect(mail).to have_body_text(%r[Once you’ve gained five signatures]) end it "includes information about how long the moderation will take" do - expect(mail).to have_body_text(%r[This usually takes a week or less]) - end - - it "doesn't include information about delayed moderation" do - expect(mail).not_to have_body_text(%r[We have a very large number of petitions to check]) - end - - context "during Christmas" do - before do - allow(Holiday).to receive(:christmas?).and_return(true) - end - - it "includes information about delayed moderation" do - expect(mail).to have_body_text(%r[but over the Christmas period it will take us a little longer]) - end - - context "when there is a moderation delay" do - let(:moderation_queue) { 500 } - - it "includes information about delayed moderation" do - expect(mail).to have_body_text(%r[We have a very large number of petitions to check]) - end - - it "doesn't include information about Christmas" do - expect(mail).not_to have_body_text(%r[but over the Christmas period it will take us a little longer]) - end - - context "and the moderation delay message has been customized" do - before do - allow(Site).to receive(:moderation_delay_message).and_return <<~MESSAGE.squish - Due to recent world events we have a very large number of petitions to - check at the moment so it may take a few weeks. Thank you for your patience. - MESSAGE - end - - it "includes the custom message" do - expect(mail).to have_body_text(%r[Due to recent world events]) - end - - it "doesn't include the normal message" do - expect(mail).not_to have_body_text(%r[This usually takes a week or less]) - end - end - end - end - - context "during Easter" do - before do - allow(Holiday).to receive(:easter?).and_return(true) - end - - it "includes information about delayed moderation" do - expect(mail).to have_body_text(%r[but over the Easter period it will take us a little longer]) - end - - context "when there is a moderation delay" do - let(:moderation_queue) { 500 } - - it "includes information about delayed moderation" do - expect(mail).to have_body_text(%r[We have a very large number of petitions to check]) - end - - it "doesn't include information about Christmas" do - expect(mail).not_to have_body_text(%r[but over the Easter period it will take us a little longer]) - end - - context "and the moderation delay message has been customized" do - before do - allow(Site).to receive(:moderation_delay_message).and_return <<~MESSAGE.squish - Due to recent world events we have a very large number of petitions to - check at the moment so it may take a few weeks. Thank you for your patience. - MESSAGE - end - - it "includes the custom message" do - expect(mail).to have_body_text(%r[Due to recent world events]) - end - - it "doesn't include the normal message" do - expect(mail).not_to have_body_text(%r[This usually takes a week or less]) - end - end - end - end - - context "when there is a moderation delay" do - let(:moderation_queue) { 500 } - - it "includes information about delayed moderation" do - expect(mail).to have_body_text(%r[We have a very large number of petitions to check]) - end - - context "and the moderation delay message has been customized" do - before do - allow(Site).to receive(:moderation_delay_message).and_return <<~MESSAGE.squish - Due to recent world events we have a very large number of petitions to - check at the moment so it may take a few weeks. Thank you for your patience. - MESSAGE - end - - it "includes the custom message" do - expect(mail).to have_body_text(%r[Due to recent world events]) - end - - it "doesn't include the normal message" do - expect(mail).not_to have_body_text(%r[This usually takes a week or less]) - end - end + expect(mail).to have_body_text(%r[This can take up to 10 working days]) end context "when a BCC address is passed" do @@ -528,7 +421,7 @@ shared_examples_for "a positive debate outcome email" do it "has the correct subject" do - expect(mail).to have_subject("Parliament debated “Allow organic vegetable vans to use red diesel”") + expect(mail).to have_subject("Your petition was debated: “Allow organic vegetable vans to use red diesel”") end it "has the positive message in the body" do @@ -538,7 +431,7 @@ shared_examples_for "a negative debate outcome email" do it "has the correct subject" do - expect(mail).to have_subject('Parliament didn’t debate “Allow organic vegetable vans to use red diesel”') + expect(mail).to have_subject('Your petition will not be debated: “Allow organic vegetable vans to use red diesel”') end it "has the negative message in the body" do @@ -654,7 +547,7 @@ shared_examples_for "a positive debate outcome email" do it "has the correct subject" do - expect(mail).to have_subject("Parliament debated “Allow organic vegetable vans to use red diesel”") + expect(mail).to have_subject("MPs debated the petition “Allow organic vegetable vans to use red diesel”") end it "has the positive message in the body" do @@ -664,7 +557,7 @@ shared_examples_for "a negative debate outcome email" do it "has the correct subject" do - expect(mail).to have_subject("Parliament didn’t debate “Allow organic vegetable vans to use red diesel”") + expect(mail).to have_subject("MPs will not debate the petition “Allow organic vegetable vans to use red diesel”") end it "has the negative message in the body" do @@ -781,11 +674,11 @@ it_behaves_like "a debate scheduled email" it "has the correct subject" do - expect(mail).to have_subject("Parliament will debate “Allow organic vegetable vans to use red diesel”") + expect(mail).to have_subject("Debate on your petition: “Allow organic vegetable vans to use red diesel”") end it "identifies them as the creator" do - expect(mail).to have_body_text(%[Parliament is going to debate your petition]) + expect(mail).to have_body_text(%[MPs are going to debate your petition]) end end @@ -796,11 +689,11 @@ it_behaves_like "a debate scheduled email" it "has the correct subject" do - expect(mail).to have_subject("Parliament will debate “Allow organic vegetable vans to use red diesel”") + expect(mail).to have_subject("MPs will debate “Allow organic vegetable vans to use red diesel”") end it "identifies them as a ordinary signature" do - expect(mail).to have_body_text(%[Parliament is going to debate the petition you signed]) + expect(mail).to have_body_text(%[MPs are going to debate the petition you signed]) end end end diff --git a/spec/mailers/sponsor_mailer_spec.rb b/spec/mailers/sponsor_mailer_spec.rb index 58c298560..a44447772 100644 --- a/spec/mailers/sponsor_mailer_spec.rb +++ b/spec/mailers/sponsor_mailer_spec.rb @@ -22,7 +22,7 @@ subject(:mail) { described_class.petition_and_email_confirmation_for_sponsor(sponsor) } it "has the correct subject" do - expect(mail.subject).to eq("Please confirm your email address") + expect(mail.subject).to eq("Sign to support: “#{petition.action}”") end it "sends it only to the sponsor" do @@ -93,7 +93,7 @@ shared_examples_for "a sponsor signed on threshold email" do it "has the correct subject" do - expect(mail.subject).to eq("We’re checking your petition") + expect(mail.subject).to eq("Your petition has five supporters: “#{petition.action}”") end it "sends it only to the creator" do @@ -107,7 +107,7 @@ end it "includes the sponsor's name in the body" do - expect(mail).to have_body_text(%r[Ally Adams]) + expect(mail).to have_body_text(%r[Someone supported your petition]) end it "includes the petition action" do @@ -123,11 +123,11 @@ end it "includes the sponsor count" do - expect(mail).to have_body_text(%r[5 people have supported your petition so far]) + expect(mail).to have_body_text(%r[5 people have supported your petition]) end it "tells the creator that the petition is being checked" do - expect(mail).to have_body_text(%r[We’re checking your petition to make sure it meets the petition standards]) + expect(mail).to have_body_text(%r[We’re checking it to make sure it meets the petition standards]) end context "when there is a moderation delay" do @@ -136,115 +136,6 @@ it "includes information about delayed moderation" do expect(mail).to have_body_text(%r[We have a very large number of petitions to check]) end - - it "doesn't include the normal message" do - expect(mail).not_to have_body_text(%r[This usually takes a week or less]) - end - - context "and the moderation delay message has been customized" do - before do - allow(Site).to receive(:moderation_delay_message).and_return <<~MESSAGE.squish - Due to recent world events we have a very large number of petitions to - check at the moment so it may take a few weeks. Thank you for your patience. - MESSAGE - end - - it "includes the custom message" do - expect(mail).to have_body_text(%r[Due to recent world events]) - end - - it "doesn't include the normal message" do - expect(mail).not_to have_body_text(%r[This usually takes a week or less]) - end - end - end - end - - context "before the Christmas period" do - around do |example| - travel_to("2017-12-21") { example.run } - end - - it_behaves_like "a sponsor signed on threshold email" - - it "doesn't include the moderation delay message" do - expect(mail).not_to have_body_text(%r[over the Christmas period it will take us a little longer than usual]) - end - end - - context "during the Christmas period" do - around do |example| - travel_to("2017-12-26") { example.run } - end - - it_behaves_like "a sponsor signed on threshold email" - - it "includes the moderation delay message" do - expect(mail).to have_body_text(%r[over the Christmas period it will take us a little longer than usual]) - end - - context "when there is a moderation delay" do - let(:moderation_queue) { 500 } - - it "doesn't include information about Christmas" do - expect(mail).not_to have_body_text(%r[over the Christmas period it will take us a little longer]) - end - end - end - - context "after the Christmas period" do - around do |example| - travel_to("2018-01-05") { example.run } - end - - it_behaves_like "a sponsor signed on threshold email" - - it "doesn't include the moderation delay message" do - expect(mail).not_to have_body_text(%r[over the Christmas period it will take us a little longer than usual]) - end - end - - context "before the Easter period" do - around do |example| - travel_to("2018-03-29") { example.run } - end - - it_behaves_like "a sponsor signed on threshold email" - - it "doesn't include the moderation delay message" do - expect(mail).not_to have_body_text(%r[over the Easter period it will take us a little longer than usual]) - end - end - - context "during the Easter period" do - around do |example| - travel_to("2018-04-01") { example.run } - end - - it_behaves_like "a sponsor signed on threshold email" - - it "includes the moderation delay message" do - expect(mail).to have_body_text(%r[over the Easter period it will take us a little longer than usual]) - end - - context "when there is a moderation delay" do - let(:moderation_queue) { 500 } - - it "doesn't include information about Easter" do - expect(mail).not_to have_body_text(%r[over the Easter period it will take us a little longer than usual]) - end - end - end - - context "after the Easter period" do - around do |example| - travel_to("2018-04-10") { example.run } - end - - it_behaves_like "a sponsor signed on threshold email" - - it "doesn't include the moderation delay message" do - expect(mail).not_to have_body_text(%r[over the Easter period it will take us a little longer than usual]) end end end