This commit is contained in:
Jason Zimdars
2025-07-21 19:01:48 -05:00
parent 211403f584
commit 97022be929
+12 -8
View File
@@ -16,6 +16,10 @@ class NotificationPusher
end
private
def account_prefix
"/#{Account.first.queenbee_id}"
end
def should_push?
notification.user.push_subscriptions.any? &&
!notification.creator.system? &&
@@ -42,37 +46,37 @@ class NotificationPusher
{
title: "RE: #{card_notification_title(card)}",
body: comment_notification_body(event),
path: "/#{Account.first.queenbee_id}#{collection_card_path(card.collection, card)}"
path: "#{account_prefix}#{collection_card_path(card.collection, card)}"
}
when "card_assigned"
{
title: card_notification_title(card),
body: "Assigned to you by #{event.creator.name}",
path: "/#{Account.first.queenbee_id}#{collection_card_path(card.collection, card)}"
path: "#{account_prefix}#{collection_card_path(card.collection, card)}"
}
when "card_published"
{
title: card_notification_title(card),
body: "Added by #{event.creator.name}",
path: "/#{Account.first.queenbee_id}#{collection_card_path(card.collection, card)}"
path: "#{account_prefix}#{collection_card_path(card.collection, card)}"
}
when "card_closed"
{
title: card_notification_title(card),
body: card.closure ? "Closed as \"#{card.closure.reason}\" by #{event.creator.name}" : "Closed by #{event.creator.name}",
path: "/#{Account.first.queenbee_id}#{collection_card_path(card.collection, card)}"
path: "#{account_prefix}#{collection_card_path(card.collection, card)}"
}
when "card_reopened"
{
title: card_notification_title(card),
body: "Reopened by #{event.creator.name}",
path: "/#{Account.first.queenbee_id}#{collection_card_path(card.collection, card)}"
path: "#{account_prefix}#{collection_card_path(card.collection, card)}"
}
else
{
title: card_notification_title(card),
body: event.creator.name,
path: "/#{Account.first.queenbee_id}#{collection_card_path(card.collection, card)}"
path: "#{account_prefix}#{collection_card_path(card.collection, card)}"
}
end
end
@@ -84,7 +88,7 @@ class NotificationPusher
{
title: "#{mention.mentioner.first_name} mentioned you",
body: mention.source.mentionable_content.truncate(200),
path: "/#{Account.first.queenbee_id}#{collection_card_path(card.collection, card)}"
path: "#{account_prefix}#{collection_card_path(card.collection, card)}"
}
end
@@ -92,7 +96,7 @@ class NotificationPusher
{
title: "New notification",
body: "You have a new notification",
path: "/#{Account.first.queenbee_id}#{notifications_path}"
path: "#{account_prefix}#{notifications_path}"
}
end