From 269382869e20a9b172dfa5f56f4d06a7722993ef Mon Sep 17 00:00:00 2001 From: Jonathan Baird Date: Sat, 11 Apr 2020 17:28:15 -0600 Subject: fix error in notifications cleanup cron --- models/users.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/models/users.js b/models/users.js index b1f3e26c..3700d1c8 100644 --- a/models/users.js +++ b/models/users.js @@ -815,7 +815,7 @@ if (Meteor.isServer) { user.addInvite(boardId); //Check if there is a subtasks board - if (board.subtasksDefaultBoardId){ + if (board.subtasksDefaultBoardId) { const subBoard = Boards.findOne(board.subtasksDefaultBoardId); //If there is, also add user to that board if (subBoard) { @@ -823,7 +823,7 @@ if (Meteor.isServer) { user.addInvite(subBoard._id); } } - + try { const params = { user: user.username, @@ -952,6 +952,7 @@ const addCronJob = _.debounce( schedule: parser => parser.text('every 1 days'), job: () => { for (const user of Users.find()) { + if (!user.profile || !user.profile.notifications) continue; for (const notification of user.profile.notifications) { if (notification.read) { const removeDate = new Date(notification.read); -- cgit v1.2.3-1-g7c22