username as from in emails

Add a site setting to display name in from header for emails
This commit is contained in:
Jeff Wong 2015-12-14 11:53:58 -08:00
parent d0bbf5c9a6
commit bffdc5907a
3 changed files with 8 additions and 2 deletions

View File

@ -156,7 +156,9 @@ class UserNotifications < ActionMailer::Base
title: post.topic.title,
post: post,
username: post.user.username,
from_alias: (SiteSetting.enable_names && SiteSetting.display_name_on_posts && post.user.name.present?) ? post.user.name : post.user.username,
from_alias: (SiteSetting.enable_names &&
SiteSetting.display_name_on_email_from &&
post.user.name.present?) ? post.user.name : post.user.username,
allow_reply_by_email: true,
use_site_subject: true,
add_re_to_subject: true,
@ -202,7 +204,8 @@ class UserNotifications < ActionMailer::Base
return unless @post = opts[:post]
user_name = @notification.data_hash[:original_username]
if @post && SiteSetting.enable_names && SiteSetting.display_name_on_posts
if @post && SiteSetting.enable_names && SiteSetting.display_name_on_email_from
name = User.where(id: @post.user_id).pluck(:name).first
user_name = name unless name.blank?
end

View File

@ -1098,6 +1098,7 @@ en:
strip_images_from_short_emails: "Strip images from emails having size less than 2800 Bytes"
short_email_length: "Short email length in Bytes"
display_name_on_email_from: "Display full names on email from fields"
pop3_polling_enabled: "Poll via POP3 for email replies."
pop3_polling_ssl: "Use SSL while connecting to the POP3 server. (Recommended)"

View File

@ -529,6 +529,8 @@ email:
client: true
strip_images_from_short_emails: true
short_email_length: 2800
display_name_on_email_from:
default: true
files:
max_image_size_kb: 3072