From 6e37f09b19be082e3fe58e0d3f3800a2837c0ae4 Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Sat, 10 Jun 2017 09:43:41 +0530 Subject: [PATCH] UX: add email to '/email/unsubscribed' page --- app/controllers/email_controller.rb | 5 +++-- app/views/email/unsubscribed.html.erb | 2 +- config/locales/server.en.yml | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/email_controller.rb b/app/controllers/email_controller.rb index 335afc4c67..76861025c3 100644 --- a/app/controllers/email_controller.rb +++ b/app/controllers/email_controller.rb @@ -109,15 +109,16 @@ class EmailController < ApplicationController redirect_to :back else if topic - redirect_to path("/email/unsubscribed?topic_id=#{topic.id}") + redirect_to path("/email/unsubscribed?topic_id=#{topic.id}&email=#{user.email}") else - redirect_to path("/email/unsubscribed") + redirect_to path("/email/unsubscribed?email=#{user.email}") end end end def unsubscribed + @email = params[:email] @topic = Topic.find_by(id: params[:topic_id].to_i) if params[:topic_id] end diff --git a/app/views/email/unsubscribed.html.erb b/app/views/email/unsubscribed.html.erb index cfa7ed31ab..a593bfed31 100644 --- a/app/views/email/unsubscribed.html.erb +++ b/app/views/email/unsubscribed.html.erb @@ -3,7 +3,7 @@

<%=t "unsubscribed.title"%>


- <%=t("unsubscribed.description", url: path("/my/preferences")).html_safe %> + <%=t("unsubscribed.description", email: @email, url: path("/my/preferences")).html_safe %>

<% if @topic %> diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 1d68e28403..3cafb4cd4c 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -723,7 +723,7 @@ en: unsubscribed: title: "Unsubscribed!" - description: "You have been unsubscribed. To change your email settings visit your user preferences." + description: "%{email} has been unsubscribed. To change your email settings visit your user preferences." topic_description: "To re-subscribe to %{link}, use the notification control at the bottom or right of the topic." unsubscribe: