aboutsummaryrefslogtreecommitdiff
path: root/vnext/server/middleware/event.js
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/server/middleware/event.js')
-rw-r--r--vnext/server/middleware/event.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/vnext/server/middleware/event.js b/vnext/server/middleware/event.js
index 8280f32b..623ee9a9 100644
--- a/vnext/server/middleware/event.js
+++ b/vnext/server/middleware/event.js
@@ -1,3 +1,5 @@
+import config from 'config'
+
import { simpleParser } from 'mailparser'
import { isPM, isReply, isService } from '../common/MessageUtils'
import { sendTelegramNotification } from '../durov'
@@ -8,7 +10,7 @@ import { send } from '../hms'
var log = debug('event')
/** @type {number[]} */
-const allSandboxIds = []
+const allSandboxIds = config.get('service.sandboxIds')
/**
* handle message event
@@ -26,8 +28,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)