mirror of
https://github.com/discourse/discourse.git
synced 2025-09-07 12:02:53 +08:00
Enable reply by email for all users, display a message in the footer indicating so.
This commit is contained in:
parent
62daeedf08
commit
3fc69337d3
4 changed files with 18 additions and 9 deletions
|
@ -39,7 +39,7 @@ class UserNotifications < ActionMailer::Base
|
||||||
private_message_from: post.user.name,
|
private_message_from: post.user.name,
|
||||||
from_alias: I18n.t(:via, username: post.user.name, site_name: SiteSetting.title),
|
from_alias: I18n.t(:via, username: post.user.name, site_name: SiteSetting.title),
|
||||||
add_unsubscribe_link: true,
|
add_unsubscribe_link: true,
|
||||||
allow_reply_by_email: user.admin?
|
allow_reply_by_email: true
|
||||||
end
|
end
|
||||||
|
|
||||||
def digest(user, opts={})
|
def digest(user, opts={})
|
||||||
|
@ -102,9 +102,6 @@ class UserNotifications < ActionMailer::Base
|
||||||
username = @notification.data_hash[:display_username]
|
username = @notification.data_hash[:display_username]
|
||||||
notification_type = Notification.types[opts[:notification].notification_type].to_s
|
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 = {
|
email_opts = {
|
||||||
topic_title: @notification.data_hash[:topic_title],
|
topic_title: @notification.data_hash[:topic_title],
|
||||||
message: @post.raw,
|
message: @post.raw,
|
||||||
|
|
|
@ -900,6 +900,9 @@ en:
|
||||||
title: "Unsubscribe"
|
title: "Unsubscribe"
|
||||||
description: "Not interested in getting these emails? No problem! Click below to unsubscribe instantly:"
|
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:
|
user_invited_to_private_message:
|
||||||
subject_template: "[%{site_name}] %{username} invited you to a private message '%{topic_title}'"
|
subject_template: "[%{site_name}] %{username} invited you to a private message '%{topic_title}'"
|
||||||
text_body_template: |
|
text_body_template: |
|
||||||
|
@ -916,7 +919,7 @@ en:
|
||||||
%{message}
|
%{message}
|
||||||
|
|
||||||
---
|
---
|
||||||
Please visit this link to respond: %{base_url}%{url}
|
%{respond_instructions}
|
||||||
|
|
||||||
user_quoted:
|
user_quoted:
|
||||||
subject_template: "[%{site_name}] %{username} quoted you in '%{topic_title}'"
|
subject_template: "[%{site_name}] %{username} quoted you in '%{topic_title}'"
|
||||||
|
@ -927,7 +930,7 @@ en:
|
||||||
%{message}
|
%{message}
|
||||||
|
|
||||||
---
|
---
|
||||||
Please visit this link to respond: %{base_url}%{url}
|
%{respond_instructions}
|
||||||
|
|
||||||
user_mentioned:
|
user_mentioned:
|
||||||
subject_template: "[%{site_name}] %{username} mentioned you in '%{topic_title}'"
|
subject_template: "[%{site_name}] %{username} mentioned you in '%{topic_title}'"
|
||||||
|
@ -938,7 +941,7 @@ en:
|
||||||
%{message}
|
%{message}
|
||||||
|
|
||||||
---
|
---
|
||||||
Please visit this link to respond: %{base_url}%{url}
|
%{respond_instructions}
|
||||||
|
|
||||||
user_posted:
|
user_posted:
|
||||||
subject_template: "[%{site_name}] %{username} posted in '%{topic_title}'"
|
subject_template: "[%{site_name}] %{username} posted in '%{topic_title}'"
|
||||||
|
@ -949,7 +952,7 @@ en:
|
||||||
%{message}
|
%{message}
|
||||||
|
|
||||||
---
|
---
|
||||||
Please visit this link to respond: %{base_url}%{url}
|
%{respond_instructions}
|
||||||
|
|
||||||
digest:
|
digest:
|
||||||
why: "Here's a brief summary of the discussion on %{site_link} since we last saw you on %{last_seen_at}."
|
why: "Here's a brief summary of the discussion on %{site_link} since we last saw you on %{last_seen_at}."
|
||||||
|
|
|
@ -39,6 +39,16 @@ module Email
|
||||||
@template_args ||= { site_name: SiteSetting.title,
|
@template_args ||= { site_name: SiteSetting.title,
|
||||||
base_url: Discourse.base_url,
|
base_url: Discourse.base_url,
|
||||||
user_preferences_url: "#{Discourse.base_url}/user_preferences" }.merge!(@opts)
|
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
|
end
|
||||||
|
|
||||||
def build_args
|
def build_args
|
||||||
|
|
|
@ -53,7 +53,6 @@ module Jobs
|
||||||
raise Discourse::InvalidParameters.new(:type) unless UserNotifications.respond_to?(args[:type])
|
raise Discourse::InvalidParameters.new(:type) unless UserNotifications.respond_to?(args[:type])
|
||||||
|
|
||||||
message = UserNotifications.send(args[:type], user, email_args)
|
message = UserNotifications.send(args[:type], user, email_args)
|
||||||
|
|
||||||
# Update the to address if we have a custom one
|
# Update the to address if we have a custom one
|
||||||
if args[:to_address].present?
|
if args[:to_address].present?
|
||||||
message.to = [args[:to_address]]
|
message.to = [args[:to_address]]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue