From d62da2fca2eaa561819e878ae415104a719e3e57 Mon Sep 17 00:00:00 2001 From: Chris Anderson Date: Mon, 4 Aug 2025 20:08:14 -0500 Subject: [PATCH] chore: stop using old device array --- apps/platform/src/campaigns/CampaignService.ts | 2 +- apps/platform/src/providers/push/PushChannel.ts | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/apps/platform/src/campaigns/CampaignService.ts b/apps/platform/src/campaigns/CampaignService.ts index d39b45e7..c018596c 100644 --- a/apps/platform/src/campaigns/CampaignService.ts +++ b/apps/platform/src/campaigns/CampaignService.ts @@ -458,7 +458,7 @@ const recipientClickhouseQuery = async (campaign: Campaign) => { } else if (campaign.channel === 'text') { return "(users.phone != '' AND users.phone IS NOT NULL)" } else if (campaign.channel === 'push') { - return '((users.devices IS NOT NULL AND NOT empty(users.devices)) OR users.has_push_device = 1)' + return '(users.has_push_device = 1)' } return '' } diff --git a/apps/platform/src/providers/push/PushChannel.ts b/apps/platform/src/providers/push/PushChannel.ts index e1c85b46..71ee6836 100644 --- a/apps/platform/src/providers/push/PushChannel.ts +++ b/apps/platform/src/providers/push/PushChannel.ts @@ -18,12 +18,7 @@ export default class PushChannel { async send(template: PushTemplate, devices: PushDevice[], variables: Variables): Promise { // Find tokens from active devices with push enabled - // Temporarily include the old table - const oldDevices = variables.user?.devices?.filter(device => device.token != null) as PushDevice[] ?? [] - const tokens: string[] = [...new Set([ - ...devices.map(device => device.token), - ...oldDevices.map(device => device.token), - ])] + const tokens = devices.map(device => device.token) const push = { tokens,