diff options
author | Vitaly Takmazov | 2024-07-29 10:49:33 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2024-07-29 10:49:33 +0300 |
commit | fc32abf39f14e2ecec38502fbcaf79c6b60e6a81 (patch) | |
tree | 51046266d4ede9c0affc3329b26ab9b5f7605acd | |
parent | f9b063ece0b321c4652533dd570065dc841b9a81 (diff) |
vnext: do not send service notifications to web
-rw-r--r-- | vnext/server/middleware/event.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/vnext/server/middleware/event.js b/vnext/server/middleware/event.js index 8280f32b..c80f2249 100644 --- a/vnext/server/middleware/event.js +++ b/vnext/server/middleware/event.js @@ -26,8 +26,9 @@ function processMessageEvent(msg) { subscribers(new URLSearchParams(JSON.parse(JSON.stringify(params)))).then(users => { return users.map(user => { log(`${user.uname}: ${user.unreadCount}`) + let tokenTypes = msg.service ? ['mpns', 'apns', 'fcm'] : ['mpns', 'apns', 'fcm', 'web'] let [sandboxTokens, productionTokens] = (user.tokens || []) - .filter(t => ['mpns', 'apns', 'fcm', 'web'].includes(t.type)) + .filter(t => tokenTypes.includes(t.type)) .map(t => t.type === 'web' ? JSON.parse(t.token) : t.token) .reduce((result, element) => { allSandboxIds.includes(user.uid) |