Add fallback message for card triage when column name is missing
This commit is contained in:
@@ -23,7 +23,11 @@ class Notification::EventPayload < Notification::DefaultPayload
|
||||
when "card_reopened"
|
||||
"Reopened by #{event.creator.name}"
|
||||
when "card_triaged"
|
||||
"Moved to #{column_name} by #{event.creator.name}"
|
||||
if column_name.present?
|
||||
"Moved to #{column_name} by #{event.creator.name}"
|
||||
else
|
||||
"Moved by #{event.creator.name}"
|
||||
end
|
||||
when "card_sent_back_to_triage"
|
||||
"Moved back to Maybe? by #{event.creator.name}"
|
||||
when "card_board_changed", "card_collection_changed"
|
||||
|
||||
@@ -77,6 +77,18 @@ class Notification::PushTarget::WebTest < ActiveSupport::TestCase
|
||||
Notification::PushTarget::Web.new(@notification).process
|
||||
end
|
||||
|
||||
test "payload for triage falls back when column name is missing" do
|
||||
event = events(:logo_published)
|
||||
event.update!(action: "card_triaged", particulars: {})
|
||||
@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 sent back to triage includes Maybe?" do
|
||||
event = events(:logo_published)
|
||||
event.update!(action: "card_sent_back_to_triage")
|
||||
|
||||
Reference in New Issue
Block a user