mirror of
https://fast.feibisi.com/https://github.com/parcelvoy/platform.git
synced 2025-09-04 12:56:14 +08:00
chore: push send cleanup
This commit is contained in:
parent
70d030be54
commit
5e50931fb7
2 changed files with 3 additions and 2 deletions
|
@ -20,10 +20,10 @@ export default class PushChannel {
|
||||||
// Find tokens from active devices with push enabled
|
// Find tokens from active devices with push enabled
|
||||||
// Temporarily include the old table
|
// Temporarily include the old table
|
||||||
const oldDevices = variables.user?.devices?.filter(device => device.token != null) as PushDevice[] ?? []
|
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),
|
...devices.map(device => device.token),
|
||||||
...oldDevices.map(device => device.token),
|
...oldDevices.map(device => device.token),
|
||||||
]
|
])]
|
||||||
|
|
||||||
const push = {
|
const push = {
|
||||||
tokens,
|
tokens,
|
||||||
|
|
|
@ -83,6 +83,7 @@ export const screenshotHtml = (template: TemplateType) => {
|
||||||
|
|
||||||
export const validateTemplates = async (projectId: number, campaignId: number) => {
|
export const validateTemplates = async (projectId: number, campaignId: number) => {
|
||||||
const templates = await allTemplates(projectId, campaignId)
|
const templates = await allTemplates(projectId, campaignId)
|
||||||
|
if (!templates.length) throw new RequestError('No templates found for this campaign.')
|
||||||
for (const template of templates) {
|
for (const template of templates) {
|
||||||
const [isValid, error] = template.map().validate()
|
const [isValid, error] = template.map().validate()
|
||||||
if (!isValid) throw error
|
if (!isValid) throw error
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue