Enable reply by email for all users, display a message in the footer indicating so.

This commit is contained in:
Robin Ward 2013-06-25 11:27:17 -04:00
parent 62daeedf08
commit 3fc69337d3
4 changed files with 18 additions and 9 deletions

View File

@ -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,

View File

@ -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}."

View File

@ -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

View File

@ -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]]