A platform for community discussion. Free, open, simple.
FIX: Adds further support for 'prioritize_full_name_in_ux' setting (#31346)
benj43ececd22d38
diff --git a/app/services/post_alerter.rb b/app/services/post_alerter.rbindex 532ad2a4afc..74d721d9011 100644--- a/app/services/post_alerter.rb+++ b/app/services/post_alerter.rb@@ -639,6 +639,10 @@ class PostAlerterdisplay_username: opts[:display_username] || post.user.username,}+ if display_name = opts[:display_name] || post.user.name+ notification_data[:display_name] = display_name+ end+opts[:custom_data].each { |k, v| notification_data[k] = v } if opts[:custom_data].is_a?(Hash)if group = opts[:group]diff --git a/spec/services/post_alerter_spec.rb b/spec/services/post_alerter_spec.rbindex 9afcdd164db..f21df6d2142 100644--- a/spec/services/post_alerter_spec.rb+++ b/spec/services/post_alerter_spec.rb@@ -1164,6 +1164,20 @@ RSpec.describe PostAlerter do)end+ it "adds display name to notification_data" do+ Plugin::Instance+ .new+ .register_modifier(:notification_data) do |notification_data|+ notification_data[:display_name] = "Benji McCool"+ notification_data+ end++ notification = PostAlerter.new.create_notification(user, type, post)+ expect(notification.data_hash[:display_name]).to eq("Benji McCool")++ DiscoursePluginRegistry.clear_modifiers!+ end+it "applies modifiers to notification_data" doPlugin::Instance.new