From d46a7ba9853c12db0ae4730c384b8280a48982d7 Mon Sep 17 00:00:00 2001 From: Matteo Pagliazzi Date: Sun, 4 Feb 2018 13:40:49 +0100 Subject: [PATCH] notifications: fix typos and add extra check --- website/server/controllers/api-v3/chat.js | 2 +- website/server/controllers/api-v3/groups.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/website/server/controllers/api-v3/chat.js b/website/server/controllers/api-v3/chat.js index e66c3de062..bfb93cc46b 100644 --- a/website/server/controllers/api-v3/chat.js +++ b/website/server/controllers/api-v3/chat.js @@ -502,7 +502,7 @@ api.seenChat = { // Remove from response user.notifications = user.notifications.filter(n => { - if (n && n.type === 'NEW_CHAT_MESSAGE' && n.data.group.id === groupId) { + if (n && n.type === 'NEW_CHAT_MESSAGE' && n.data && n.data.group && n.data.group.id === groupId) { return false; } diff --git a/website/server/controllers/api-v3/groups.js b/website/server/controllers/api-v3/groups.js index b23d240e75..ae7c8c1234 100644 --- a/website/server/controllers/api-v3/groups.js +++ b/website/server/controllers/api-v3/groups.js @@ -703,7 +703,7 @@ function _removeMessagesFromMember (member, groupId) { } member.notifications = member.notifications.filter(n => { - if (n && n.type === 'NEW_CHAT_MESSAGE' && n.date && n.data.group && n.data.group.id === groupId) { + if (n && n.type === 'NEW_CHAT_MESSAGE' && n.data && n.data.group && n.data.group.id === groupId) { return false; }