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:
marstall
2024-12-20 11:43:13 -05:00
committed by GitHub
parent d18bf67868
commit 3e8e861103
2 changed files with 27 additions and 3 deletions

View File

@@ -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