mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
The EmailBuilder now creates the Reply by Email Key if necessary.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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?
|
||||
|
||||
Reference in New Issue
Block a user