From b93752dbb577448f0760699713eb0b1d638fda08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jirka=20Hut=C3=A1rek?= Date: Fri, 27 Feb 2026 18:10:37 +0100 Subject: [PATCH] Mention column name and creator in push event body when card is moved between columns --- app/models/notification/event_payload.rb | 6 ++++++ test/models/notification/push_target/web_test.rb | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/app/models/notification/event_payload.rb b/app/models/notification/event_payload.rb index fba3a6cb2..f43c2b0d5 100644 --- a/app/models/notification/event_payload.rb +++ b/app/models/notification/event_payload.rb @@ -22,6 +22,8 @@ class Notification::EventPayload < Notification::DefaultPayload card.closure ? "Moved to Done by #{event.creator.name}" : "Closed by #{event.creator.name}" when "card_reopened" "Reopened by #{event.creator.name}" + when "card_triaged" + "Moved to #{column_name} by #{event.creator.name}" else event.creator.name end @@ -57,6 +59,10 @@ class Notification::EventPayload < Notification::DefaultPayload card.title.presence || "Card #{card.number}" end + def column_name + event.particulars.dig("particulars", "column") + end + def card_url_with_comment_anchor(comment) Rails.application.routes.url_helpers.card_url( comment.card, diff --git a/test/models/notification/push_target/web_test.rb b/test/models/notification/push_target/web_test.rb index 94628fb82..3516c96ea 100644 --- a/test/models/notification/push_target/web_test.rb +++ b/test/models/notification/push_target/web_test.rb @@ -65,6 +65,18 @@ class Notification::PushTarget::WebTest < ActiveSupport::TestCase Notification::PushTarget::Web.new(@notification).process end + test "payload for triage includes column name" do + event = events(:logo_published) + event.update!(action: "card_triaged", particulars: { "particulars" => { "column" => "In Progress" } }) + @notification.update!(source: event) + + @web_push_pool.expects(:queue).once.with do |payload, _| + payload[:body] == "Moved to In Progress by #{event.creator.name}" + end + + Notification::PushTarget::Web.new(@notification).process + end + test "payload for mention includes mentioner name" do @web_push_pool.expects(:queue).once.with do |payload, _| payload[:title].include?("mentioned you")