summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander.sulfrian@fu-berlin.de>2016-08-16 17:45:53 +0200
committerAlexander Sulfrian <alexander.sulfrian@fu-berlin.de>2016-08-16 19:19:55 +0200
commit4013184801fba254ff5e76d28a7b9293fd4ef14a (patch)
treeac956cf03bbf2771685308513a3e62580a57bb87
parent7b0e57380aee122f19aea64e09b63670a51662fb (diff)
downloadwekan-4013184801fba254ff5e76d28a7b9293fd4ef14a.tar.gz
wekan-4013184801fba254ff5e76d28a7b9293fd4ef14a.tar.bz2
wekan-4013184801fba254ff5e76d28a7b9293fd4ef14a.zip
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.
-rw-r--r--models/boards.js12
1 files changed, 12 insertions, 0 deletions
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,
+ },
+ }
+ );
+ }
});
}
});