diff --git a/app/mailers/user_notifications.rb b/app/mailers/user_notifications.rb index ef6e8ae07bf..af2e01ad999 100644 --- a/app/mailers/user_notifications.rb +++ b/app/mailers/user_notifications.rb @@ -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