notifications: fix typos and add extra check

This commit is contained in:
Matteo Pagliazzi
2018-02-04 13:40:49 +01:00
parent 4efbbd7bac
commit d46a7ba985
2 changed files with 2 additions and 2 deletions

View File

@@ -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;
}

View File

@@ -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;
}