notifications: fixes
This commit is contained in:
@@ -703,7 +703,7 @@ function _removeMessagesFromMember (member, groupId) {
|
||||
}
|
||||
|
||||
member.notifications = member.notifications.filter(n => {
|
||||
if (n.type === 'NEW_CHAT_MESSAGE' && n.data.group && n.data.group.id === groupId) {
|
||||
if (n && n.type === 'NEW_CHAT_MESSAGE' && n.date && n.data.group && n.data.group.id === groupId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1277,7 +1277,7 @@ api.removeGroupManager = {
|
||||
|
||||
let manager = await User.findById(managerId, 'notifications').exec();
|
||||
let newNotifications = manager.notifications.filter((notification) => {
|
||||
const isGroupTaskNotification = notification.type.indexOf('GROUP_TASK_') === 0;
|
||||
const isGroupTaskNotification = notification && notification.type && notification.type.indexOf('GROUP_TASK_') === 0;
|
||||
|
||||
return !isGroupTaskNotification;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user