The EmailBuilder now creates the Reply by Email Key if necessary.

This commit is contained in:
Robin Ward
2013-06-13 10:56:16 -04:00
parent cf9b6beb13
commit 49c09898e2
8 changed files with 77 additions and 100 deletions

View File

@@ -107,13 +107,10 @@ class UserNotifications < ActionMailer::Base
url: @post.url,
username: username,
add_unsubscribe_link: true,
allow_reply_by_email: opts[:allow_reply_by_email],
template: "user_notifications.user_#{notification_type}"
}
if opts[:allow_reply_by_email] && SiteSetting.reply_by_email_enabled?
email_opts[:allow_reply_by_email] = true
end
# If we have a display name, change the from address
if username.present?
email_opts[:from_alias] = I18n.t(:via, username: username, site_name: SiteSetting.title)

View File

@@ -3,13 +3,6 @@ class EmailLog < ActiveRecord::Base
validates_presence_of :email_type
validates_presence_of :to_address
before_create do
# We only generate a reply
if SiteSetting.reply_by_email_enabled?
self.reply_key = SecureRandom.hex(16)
end
end
after_create do
# Update last_emailed_at if the user_id is present
User.update_all("last_emailed_at = CURRENT_TIMESTAMP", id: user_id) if user_id.present?