Mention column name and creator in push event body when card is moved between columns
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user