diff --git a/app/mailers/user_notifications.rb b/app/mailers/user_notifications.rb index 6c62107d151..7e18c78fc55 100644 --- a/app/mailers/user_notifications.rb +++ b/app/mailers/user_notifications.rb @@ -39,7 +39,7 @@ class UserNotifications < ActionMailer::Base private_message_from: post.user.name, from_alias: I18n.t(:via, username: post.user.name, site_name: SiteSetting.title), add_unsubscribe_link: true, - allow_reply_by_email: user.admin? + allow_reply_by_email: true end def digest(user, opts={}) @@ -102,9 +102,6 @@ class UserNotifications < ActionMailer::Base username = @notification.data_hash[:display_username] notification_type = Notification.types[opts[:notification].notification_type].to_s - # For now only admins can reply by email - opts.delete(:allow_reply_by_email) unless user.admin? - email_opts = { topic_title: @notification.data_hash[:topic_title], message: @post.raw, diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 330584bfa97..097d873dc26 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -900,6 +900,9 @@ en: title: "Unsubscribe" description: "Not interested in getting these emails? No problem! Click below to unsubscribe instantly:" + reply_by_email: "You can reply directly to this email to respond, or visit %{base_url}%{url} to reply in your browser." + visit_link_to_respond: "Please visit this link to respond: %{base_url}%{url}" + user_invited_to_private_message: subject_template: "[%{site_name}] %{username} invited you to a private message '%{topic_title}'" text_body_template: | @@ -916,7 +919,7 @@ en: %{message} --- - Please visit this link to respond: %{base_url}%{url} + %{respond_instructions} user_quoted: subject_template: "[%{site_name}] %{username} quoted you in '%{topic_title}'" @@ -927,7 +930,7 @@ en: %{message} --- - Please visit this link to respond: %{base_url}%{url} + %{respond_instructions} user_mentioned: subject_template: "[%{site_name}] %{username} mentioned you in '%{topic_title}'" @@ -938,7 +941,7 @@ en: %{message} --- - Please visit this link to respond: %{base_url}%{url} + %{respond_instructions} user_posted: subject_template: "[%{site_name}] %{username} posted in '%{topic_title}'" @@ -949,7 +952,7 @@ en: %{message} --- - Please visit this link to respond: %{base_url}%{url} + %{respond_instructions} digest: why: "Here's a brief summary of the discussion on %{site_link} since we last saw you on %{last_seen_at}." diff --git a/lib/email/message_builder.rb b/lib/email/message_builder.rb index 321c8d25d1c..10bc3f21dfb 100644 --- a/lib/email/message_builder.rb +++ b/lib/email/message_builder.rb @@ -39,6 +39,16 @@ module Email @template_args ||= { site_name: SiteSetting.title, base_url: Discourse.base_url, user_preferences_url: "#{Discourse.base_url}/user_preferences" }.merge!(@opts) + + if @template_args[:url].present? + if allow_reply_by_email? and + @template_args[:respond_instructions] = I18n.t('user_notifications.reply_by_email', @template_args) + else + @template_args[:respond_instructions] = I18n.t('user_notifications.visit_link_to_respond', @template_args) + end + end + + @template_args end def build_args diff --git a/lib/jobs/user_email.rb b/lib/jobs/user_email.rb index 19468c20d85..40f7a0010fc 100644 --- a/lib/jobs/user_email.rb +++ b/lib/jobs/user_email.rb @@ -53,7 +53,6 @@ module Jobs raise Discourse::InvalidParameters.new(:type) unless UserNotifications.respond_to?(args[:type]) message = UserNotifications.send(args[:type], user, email_args) - # Update the to address if we have a custom one if args[:to_address].present? message.to = [args[:to_address]]