correcly grap name, omit needless query

This commit is contained in:
Sam 2015-05-06 12:55:33 +10:00
parent c96a057395
commit c6fe90006e
1 changed files with 2 additions and 1 deletions

View File

@ -188,7 +188,8 @@ class UserNotifications < ActionMailer::Base
user_name = @notification.data_hash[:original_username]
if @post && SiteSetting.enable_names && SiteSetting.display_name_on_posts
user_name = User.find_by(id: @post.user_id).name if !User.find_by(id: @post.user_id).name.empty?
name = User.where(id: @post.user_id).pluck(:name).first
user_name = name unless name.blank?
end
notification_type = opts[:notification_type] || Notification.types[@notification.notification_type].to_s