diff --git a/app/assets/stylesheets/email_subscriptions.scss b/app/assets/stylesheets/email_subscriptions.scss index 731aa308f..ecffec8c9 100644 --- a/app/assets/stylesheets/email_subscriptions.scss +++ b/app/assets/stylesheets/email_subscriptions.scss @@ -1,20 +1,21 @@ .unsubscribed { background: #66e2d5; - color: white; + color: #0c3d38; margin: 100px auto; padding: 40px 10px; - @media screen and (min-width: 550px) { + @media screen and (min-width: 645px) { margin: 100px auto; - width: 450px; + width: 565px; padding: 40px; } } .unsubscribed__title { font-weight: 600; + font-size: 26px; } .unsubscribed__message { - font-weight: 300; + font-weight: 400; } diff --git a/app/controllers/email_subscriptions_controller.rb b/app/controllers/email_subscriptions_controller.rb index 01ab49ce5..33a5319a4 100644 --- a/app/controllers/email_subscriptions_controller.rb +++ b/app/controllers/email_subscriptions_controller.rb @@ -5,10 +5,22 @@ class EmailSubscriptionsController < ApplicationController if verified_params[:expires_at] > Time.now user = User.find(verified_params[:user_id]) user.update(verified_params[:email_type] => false) + @email_type = preferred_email_name(verified_params[:email_type]) else not_found end rescue ActiveSupport::MessageVerifier::InvalidSignature not_found end + + def preferred_email_name(given_email_type) + emails_type = { + email_digest_periodic: "DEV digest emails", + email_comment_notifications: "comment notifications", + email_follower_notifications: "follower notifications", + email_mention_notifications: "mention notifications", + email_unread_notifications: "unread notifications", + } + emails_type[given_email_type] + end end diff --git a/app/views/email_subscriptions/unsubscribe.html.erb b/app/views/email_subscriptions/unsubscribe.html.erb index f7cee2041..2dab79fb6 100644 --- a/app/views/email_subscriptions/unsubscribe.html.erb +++ b/app/views/email_subscriptions/unsubscribe.html.erb @@ -1,10 +1,11 @@ +
- You have been successfully unsubscribed. 😔 + You have been unsubscribed from <%= @email_type %>. 😔

- If that was a mistake or you would like to update other email preferences, + You will no longer receive emails like this. If you'd like to re-subscribe or manage your full email preferences, please click here.
diff --git a/spec/support/fixtures/approvals/email_subscriptionsunsubscribe.approved.html b/spec/support/fixtures/approvals/email_subscriptionsunsubscribe.approved.html new file mode 100644 index 000000000..88972ee4f --- /dev/null +++ b/spec/support/fixtures/approvals/email_subscriptionsunsubscribe.approved.html @@ -0,0 +1,18 @@ + + + + + + + +
+
+ You have been unsubscribed from DEV digest emails. 😔 +
+
+ You will no longer receive emails like this. If you'd like to re-subscribe or manage your full email preferences, please + click here. +
+
+ + diff --git a/spec/views/email_subscriptions/unsubscribe.html.erb_spec.rb b/spec/views/email_subscriptions/unsubscribe.html.erb_spec.rb new file mode 100644 index 000000000..09e0e31ca --- /dev/null +++ b/spec/views/email_subscriptions/unsubscribe.html.erb_spec.rb @@ -0,0 +1,9 @@ +require "rails_helper" + +RSpec.describe "email_subscriptions/unsubscribe.html.erb", type: :view do + it "works" do + assign(:email_type, "DEV digest emails") + render + Approvals.verify(rendered, name: "email_subscriptions/unsubscribe", format: :html) + end +end