aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2024-07-29 10:49:33 +0300
committerGravatar Vitaly Takmazov2024-07-29 10:49:33 +0300
commitfc32abf39f14e2ecec38502fbcaf79c6b60e6a81 (patch)
tree51046266d4ede9c0affc3329b26ab9b5f7605acd
parentf9b063ece0b321c4652533dd570065dc841b9a81 (diff)
vnext: do not send service notifications to web
-rw-r--r--vnext/server/middleware/event.js3
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)