Handle collection change the same as board change

This commit is contained in:
Jirka Hutárek
2026-02-27 18:42:49 +01:00
parent 566dd8ded2
commit 7702e49afa
2 changed files with 13 additions and 1 deletions
+1 -1
View File
@@ -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
@@ -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" } })