From 7702e49afa567ece24675635272dede048aedbc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jirka=20Hut=C3=A1rek?= Date: Fri, 27 Feb 2026 18:42:49 +0100 Subject: [PATCH] Handle collection change the same as board change --- app/models/notification/event_payload.rb | 2 +- test/models/notification/push_target/web_test.rb | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/models/notification/event_payload.rb b/app/models/notification/event_payload.rb index 9fee43032..a936c3e5c 100644 --- a/app/models/notification/event_payload.rb +++ b/app/models/notification/event_payload.rb @@ -26,7 +26,7 @@ class Notification::EventPayload < Notification::DefaultPayload "Moved to #{column_name} by #{event.creator.name}" when "card_sent_back_to_triage" "Moved back to Maybe? by #{event.creator.name}" - when "card_board_changed" + when "card_board_changed", "card_collection_changed" if new_board_name.present? "Moved to #{new_board_name} by #{event.creator.name}" else diff --git a/test/models/notification/push_target/web_test.rb b/test/models/notification/push_target/web_test.rb index 4dd95ac40..8f3e6eb9b 100644 --- a/test/models/notification/push_target/web_test.rb +++ b/test/models/notification/push_target/web_test.rb @@ -113,6 +113,18 @@ class Notification::PushTarget::WebTest < ActiveSupport::TestCase Notification::PushTarget::Web.new(@notification).process end + test "payload for collection change includes new collection name" do + event = events(:logo_published) + event.update!(action: "card_collection_changed", particulars: { "particulars" => { "new_collection" => "New Collection" } }) + @notification.update!(source: event) + + @web_push_pool.expects(:queue).once.with do |payload, _| + payload[:body] == "Moved to New Collection by #{event.creator.name}" + end + + Notification::PushTarget::Web.new(@notification).process + end + test "payload for title change includes new title" do event = events(:logo_published) event.update!(action: "card_title_changed", particulars: { "particulars" => { "old_title" => "Old Title", "new_title" => "New Title" } })