mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
Private messages have instructions for reply by email. We also strip X-Discourse headers
before sending the message as they are no longer needed.
This commit is contained in:
parent
3fc69337d3
commit
3067c2ed3b
3 changed files with 13 additions and 5 deletions
|
@ -39,7 +39,9 @@ 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: true
|
allow_reply_by_email: true,
|
||||||
|
post_id: post.id,
|
||||||
|
topic_id: post.topic_id
|
||||||
end
|
end
|
||||||
|
|
||||||
def digest(user, opts={})
|
def digest(user, opts={})
|
||||||
|
|
|
@ -973,7 +973,7 @@ en:
|
||||||
%{message}
|
%{message}
|
||||||
|
|
||||||
---
|
---
|
||||||
Please visit this link to respond: %{base_url}%{url}
|
%{respond_instructions}
|
||||||
|
|
||||||
forgot_password:
|
forgot_password:
|
||||||
subject_template: "[%{site_name}] Password reset"
|
subject_template: "[%{site_name}] Password reset"
|
||||||
|
|
|
@ -37,20 +37,26 @@ module Email
|
||||||
end
|
end
|
||||||
|
|
||||||
@message.text_part.content_type = 'text/plain; charset=UTF-8'
|
@message.text_part.content_type = 'text/plain; charset=UTF-8'
|
||||||
@message.deliver
|
|
||||||
|
|
||||||
|
# Set up the email log
|
||||||
to_address = @message.to
|
to_address = @message.to
|
||||||
to_address = to_address.first if to_address.is_a?(Array)
|
to_address = to_address.first if to_address.is_a?(Array)
|
||||||
|
|
||||||
email_log = EmailLog.new(email_type: @email_type,
|
email_log = EmailLog.new(email_type: @email_type,
|
||||||
to_address: to_address,
|
to_address: to_address,
|
||||||
user_id: @user.try(:id))
|
user_id: @user.try(:id))
|
||||||
|
|
||||||
email_log.post_id = @messager
|
|
||||||
add_header_to_log('X-Discourse-Reply-Key', email_log, :reply_key)
|
add_header_to_log('X-Discourse-Reply-Key', email_log, :reply_key)
|
||||||
add_header_to_log('X-Discourse-Post-Id', email_log, :post_id)
|
add_header_to_log('X-Discourse-Post-Id', email_log, :post_id)
|
||||||
add_header_to_log('X-Discourse-Topic-Id', email_log, :topic_id)
|
add_header_to_log('X-Discourse-Topic-Id', email_log, :topic_id)
|
||||||
|
|
||||||
|
# Remove headers we don't need anymore
|
||||||
|
@message.header['X-Discourse-Topic-Id'] = nil
|
||||||
|
@message.header['X-Discourse-Post-Id'] = nil
|
||||||
|
@message.header['X-Discourse-Reply-Key'] = nil
|
||||||
|
|
||||||
|
@message.deliver
|
||||||
|
|
||||||
|
# Save and return the email log
|
||||||
email_log.save!
|
email_log.save!
|
||||||
email_log
|
email_log
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue