From 97022be9294e4c75a9ec83bb07aa805d83bc7281 Mon Sep 17 00:00:00 2001 From: Jason Zimdars Date: Mon, 21 Jul 2025 19:01:48 -0500 Subject: [PATCH] Clean up --- app/models/notification_pusher.rb | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/app/models/notification_pusher.rb b/app/models/notification_pusher.rb index 1bf48ab23..2f3df0e49 100644 --- a/app/models/notification_pusher.rb +++ b/app/models/notification_pusher.rb @@ -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