From 21b51090bfaef940f2b050c8a4d05246b1824bef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Fri, 26 Feb 2016 23:56:56 +0100 Subject: [PATCH] FIX: don't tell staged users they can visit topics in email notifications --- app/mailers/user_notifications.rb | 3 ++- config/locales/server.en.yml | 3 ++- lib/email/message_builder.rb | 8 +++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/mailers/user_notifications.rb b/app/mailers/user_notifications.rb index 9f630c477..9aca0902e 100644 --- a/app/mailers/user_notifications.rb +++ b/app/mailers/user_notifications.rb @@ -327,6 +327,7 @@ class UserNotifications < ActionMailer::Base add_unsubscribe_via_email_link: user.user_option.mailing_list_mode, unsubscribe_url: post.topic.unsubscribe_url, allow_reply_by_email: allow_reply_by_email, + only_reply_by_email: allow_reply_by_email && user.staged, use_site_subject: use_site_subject, add_re_to_subject: add_re_to_subject, show_category_in_subject: show_category_in_subject, @@ -336,7 +337,7 @@ class UserNotifications < ActionMailer::Base html_override: html, site_description: SiteSetting.site_description, site_title: SiteSetting.title, - style: :notification + style: :notification, } # If we have a display name, change the from address diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index ddda03346..4d81a8cd7 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -2004,8 +2004,9 @@ en: header_instructions: '' reply_by_email: "[Visit Topic](%{base_url}%{url}) or reply to this email to respond" - visit_link_to_respond: "[Visit Topic](%{base_url}%{url}) to respond" reply_by_email_pm: "[Visit Message](%{base_url}%{url}) or reply to this email to respond" + only_reply_by_email: "Reply to this email to respond" + visit_link_to_respond: "[Visit Topic](%{base_url}%{url}) to respond" visit_link_to_respond_pm: "[Visit Message](%{base_url}%{url}) to respond" posted_by: "Posted by %{username} on %{post_date}" diff --git a/lib/email/message_builder.rb b/lib/email/message_builder.rb index 76754654c..efa0eeab4 100644 --- a/lib/email/message_builder.rb +++ b/lib/email/message_builder.rb @@ -33,11 +33,13 @@ module Email if @opts[:include_respond_instructions] == false @template_args[:respond_instructions] = '' else - @template_args[:respond_instructions] = if allow_reply_by_email? - @opts[:private_reply] ? I18n.t('user_notifications.reply_by_email_pm', @template_args) : I18n.t('user_notifications.reply_by_email', @template_args) + if @opts[:only_reply_by_email] + string = "user_notifications.only_reply_by_email" else - @opts[:private_reply] ? I18n.t('user_notifications.visit_link_to_respond_pm', @template_args) : I18n.t('user_notifications.visit_link_to_respond', @template_args) + string = allow_reply_by_email? ? "user_notifications.reply_by_email" : "user_notifications.visit_link_to_respond" + string << "_pm" if @opts[:private_reply] end + @template_args[:respond_instructions] = I18n.t(string, @template_args) end end end