From ad45eabfdcac86989b2b0f9d9643e17a3cb0bd83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jirka=20Hut=C3=A1rek?= Date: Fri, 27 Feb 2026 19:00:14 +0100 Subject: [PATCH] Add fallback handling for blank board and title names in event payloads --- .../notification/push_target/web_test.rb | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/test/models/notification/push_target/web_test.rb b/test/models/notification/push_target/web_test.rb index c2e265e28..37f23b557 100644 --- a/test/models/notification/push_target/web_test.rb +++ b/test/models/notification/push_target/web_test.rb @@ -140,6 +140,21 @@ class Notification::PushTarget::WebTest < ActiveSupport::TestCase Notification::PushTarget::Web.new(@notification).process end + test "payload for board change falls back when board name is blank" do + event = events(:logo_published) + event.update!( + action: "card_board_changed", + particulars: { "particulars" => { "new_board" => "" } } + ) + @notification.update!(source: event) + + @web_push_pool.expects(:queue).once.with do |payload, _| + payload[:body] == "Moved by #{event.creator.name}" + end + + Notification::PushTarget::Web.new(@notification).process + end + test "payload for collection change includes new collection name" do event = events(:logo_published) event.update!( @@ -206,6 +221,18 @@ class Notification::PushTarget::WebTest < ActiveSupport::TestCase Notification::PushTarget::Web.new(@notification).process end + test "payload for title change falls back when title is blank" do + event = events(:logo_published) + event.update!(action: "card_title_changed", particulars: { "particulars" => { "new_title" => "" } }) + @notification.update!(source: event) + + @web_push_pool.expects(:queue).once.with do |payload, _| + payload[:body] == "Renamed by #{event.creator.name}" + end + + Notification::PushTarget::Web.new(@notification).process + end + test "payload for postponed includes Not Now" do event = events(:logo_published) event.update!(action: "card_postponed")