Ensure that cards with an empty title aren't mysterious in notifs
Use something like "Card 55" instead of it being blank or raising an exception.
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
module NotificationsHelper
|
||||
def event_notification_title(event)
|
||||
case event_notification_action(event)
|
||||
when "comment_created" then "RE: " + event.eventable.card.title
|
||||
when "card_assigned" then "Assigned to #{event.assignees.pluck(:name).to_sentence}: " + event.eventable.title
|
||||
else event.eventable.title
|
||||
when "comment_created" then "RE: #{card_notification_title(event.eventable.card)}"
|
||||
when "card_assigned" then "Assigned to #{event.assignees.pluck(:name).to_sentence}: #{card_notification_title(event.eventable)}"
|
||||
else card_notification_title(event.eventable)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -59,4 +59,8 @@ module NotificationsHelper
|
||||
comment = event.eventable
|
||||
"#{strip_tags(comment.body_html).blank? ? "#{event.creator.name} replied" : "#{event.creator.name}:" } #{strip_tags(comment.body_html).truncate(200)}"
|
||||
end
|
||||
|
||||
def card_notification_title(card)
|
||||
card.title.presence || "Card #{card.id}"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user