Merge pull request #3922 from featheredtoast/username-email-from-field

username as from in emails
This commit is contained in:
Sam 2015-12-15 21:23:53 +11:00
commit 2230879a24
3 changed files with 8 additions and 2 deletions

View File

@ -156,7 +156,9 @@ class UserNotifications < ActionMailer::Base
title: post.topic.title, title: post.topic.title,
post: post, post: post,
username: post.user.username, 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, allow_reply_by_email: true,
use_site_subject: true, use_site_subject: true,
add_re_to_subject: true, add_re_to_subject: true,
@ -202,7 +204,8 @@ class UserNotifications < ActionMailer::Base
return unless @post = opts[:post] return unless @post = opts[:post]
user_name = @notification.data_hash[:original_username] 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 name = User.where(id: @post.user_id).pluck(:name).first
user_name = name unless name.blank? user_name = name unless name.blank?
end end

View File

@ -1098,6 +1098,7 @@ en:
strip_images_from_short_emails: "Strip images from emails having size less than 2800 Bytes" strip_images_from_short_emails: "Strip images from emails having size less than 2800 Bytes"
short_email_length: "Short email length in 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_enabled: "Poll via POP3 for email replies."
pop3_polling_ssl: "Use SSL while connecting to the POP3 server. (Recommended)" pop3_polling_ssl: "Use SSL while connecting to the POP3 server. (Recommended)"

View File

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