correcly grap name, omit needless query
This commit is contained in:
parent
c96a057395
commit
c6fe90006e
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue