chore: stop using old device array

This commit is contained in:
Chris Anderson 2025-08-04 20:08:14 -05:00
parent b15e8d2be1
commit d62da2fca2
2 changed files with 2 additions and 7 deletions

View file

@ -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 ''
}

View file

@ -18,12 +18,7 @@ export default class PushChannel {
async send(template: PushTemplate, devices: PushDevice[], variables: Variables): Promise<PushResponse | undefined> {
// 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,