chore: push send cleanup

This commit is contained in:
Chris Anderson 2025-07-18 08:40:16 -05:00
parent 70d030be54
commit 5e50931fb7
2 changed files with 3 additions and 2 deletions

View file

@ -20,10 +20,10 @@ export default class PushChannel {
// 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[] = [
const tokens: string[] = [...new Set([
...devices.map(device => device.token),
...oldDevices.map(device => device.token),
]
])]
const push = {
tokens,

View file

@ -83,6 +83,7 @@ export const screenshotHtml = (template: TemplateType) => {
export const validateTemplates = async (projectId: number, campaignId: number) => {
const templates = await allTemplates(projectId, campaignId)
if (!templates.length) throw new RequestError('No templates found for this campaign.')
for (const template of templates) {
const [isValid, error] = template.map().validate()
if (!isValid) throw error