mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: return full name in /notifications.json (#30335)
* wip: return full name in /notifications.json * DEV: test for full name * DEV: add test for enable_names=true * DEV: add notification6, cleanup * DEV: fix tests
This commit is contained in:
@@ -371,13 +371,17 @@ class Notification < ActiveRecord::Base
|
||||
(
|
||||
notification.data_hash[:username] || notification.data_hash[:display_username] ||
|
||||
notification.data_hash[:mentioned_by_username] ||
|
||||
notification.data_hash[:invited_by_username]
|
||||
notification.data_hash[:invited_by_username] ||
|
||||
notification.data_hash[:original_username]
|
||||
)&.downcase
|
||||
end
|
||||
|
||||
users = User.where(username_lower: usernames.uniq).index_by(&:username_lower)
|
||||
notifications.each do |notification|
|
||||
notification.acting_user = users[notification.acting_username]
|
||||
notification.data_hash[
|
||||
:original_name
|
||||
] = notification.acting_user&.name if SiteSetting.enable_names
|
||||
end
|
||||
|
||||
notifications
|
||||
|
||||
Reference in New Issue
Block a user