aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2023-06-07 21:57:20 +0300
committerGravatar Vitaly Takmazov2023-06-07 21:57:20 +0300
commit2bc4c4580552ad084c5dd06f22ee1ea333905a14 (patch)
tree0e4f625921249f6e140fad5df44e2581f1c9a07f
parent7bbbcf0df392be397ce70e78d218e0d2fcd0815a (diff)
vnext: cleanup lint warnings
-rw-r--r--vnext/server/middleware/event.js14
-rw-r--r--vnext/server/sender.js3
-rw-r--r--vnext/src/utils/embed.js2
3 files changed, 12 insertions, 7 deletions
diff --git a/vnext/server/middleware/event.js b/vnext/server/middleware/event.js
index 59f36950..8280f32b 100644
--- a/vnext/server/middleware/event.js
+++ b/vnext/server/middleware/event.js
@@ -24,12 +24,12 @@ function processMessageEvent(msg) {
params.mid = msg.mid
}
subscribers(new URLSearchParams(JSON.parse(JSON.stringify(params)))).then(users => {
- users.forEach(user => {
+ return users.map(user => {
log(`${user.uname}: ${user.unreadCount}`)
let [sandboxTokens, productionTokens] = (user.tokens || [])
.filter(t => ['mpns', 'apns', 'fcm', 'web'].includes(t.type))
.map(t => t.type === 'web' ? JSON.parse(t.token) : t.token)
- .reduce((result, element, i) => {
+ .reduce((result, element) => {
allSandboxIds.includes(user.uid)
? result[0].push(element)
: result[1].push(element)
@@ -44,10 +44,14 @@ function processMessageEvent(msg) {
.filter(t => t.type === 'hcm')
.map(t => t.token)
log(`${user.uname}: ${hmsIds}`)
- send(msg, hmsIds).then(() => {
- // TODO: handle results
- }).catch(log)
+ return hmsIds
})
+ }).then(userHmsIds => {
+ userHmsIds.forEach(hmsIds => {
+ send(msg, hmsIds)
+ })
+ }).then(() => {
+ // TODO: handle results
}).catch(log)
}
diff --git a/vnext/server/sender.js b/vnext/server/sender.js
index 48b5fb78..3f2dbc3b 100644
--- a/vnext/server/sender.js
+++ b/vnext/server/sender.js
@@ -118,7 +118,8 @@ export function buildNotification(user, msg) {
},
timeToLive: 0
}
- let { tokens, ...subscriber } = user
+ const subscriber = { ...user }
+ delete subscriber.tokens
if (msg.service) {
template.contentAvailable = true
template.custom.service = true
diff --git a/vnext/src/utils/embed.js b/vnext/src/utils/embed.js
index afec71b4..75985582 100644
--- a/vnext/src/utils/embed.js
+++ b/vnext/src/utils/embed.js
@@ -393,7 +393,7 @@ export function embedAll() {
}
/**
* Embed URLs to container
- * @param {NodeListOf<Element>} urls
+ * @param {Element[]} urls
* @param {HTMLDivElement} embedContainer
*/
export function embedUrls(urls, embedContainer) {