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:
Robin Ward 2013-06-25 11:35:26 -04:00
parent 3fc69337d3
commit 3067c2ed3b
3 changed files with 13 additions and 5 deletions

View File

@ -39,7 +39,9 @@ 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: true
allow_reply_by_email: true,
post_id: post.id,
topic_id: post.topic_id
end
def digest(user, opts={})

View File

@ -973,7 +973,7 @@ en:
%{message}
---
Please visit this link to respond: %{base_url}%{url}
%{respond_instructions}
forgot_password:
subject_template: "[%{site_name}] Password reset"

View File

@ -37,20 +37,26 @@ module Email
end
@message.text_part.content_type = 'text/plain; charset=UTF-8'
@message.deliver
# Set up the email log
to_address = @message.to
to_address = to_address.first if to_address.is_a?(Array)
email_log = EmailLog.new(email_type: @email_type,
to_address: to_address,
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-Post-Id', email_log, :post_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