From 4013184801fba254ff5e76d28a7b9293fd4ef14a Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Tue, 16 Aug 2016 17:45:53 +0200 Subject: Models: Remove board from starred list This will fix the starred counter. If the board is not public, the user is unable to see the board and remove it from the list of starred boards. --- models/boards.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'models') diff --git a/models/boards.js b/models/boards.js index 02f28b5a..3051ef1e 100644 --- a/models/boards.js +++ b/models/boards.js @@ -494,6 +494,18 @@ if (Meteor.isServer) { const board = Boards._transform(doc); board.setWatcher(memberId, false); + + // Remove board from users starred list + if (!board.isPublic()) { + Users.update( + memberId, + { + $pull: { + 'profile.starredBoards': boardId, + }, + } + ); + } }); } }); -- cgit v1.2.3-1-g7c22