diff options
author | Benjamin Tissoires <benjamin.tissoires@redhat.com> | 2018-06-27 16:44:58 +0200 |
---|---|---|
committer | Benjamin Tissoires <benjamin.tissoires@redhat.com> | 2018-10-24 16:55:33 +0200 |
commit | e5949504b7ed42ad59742d2a0aa001fe6c762873 (patch) | |
tree | 18f115a627153724c648da8b27b7f8e551d44c3b | |
parent | 2ce1ba37a1d0a09f8b3d2a1db4c8a11d1f98caa0 (diff) | |
download | wekan-e5949504b7ed42ad59742d2a0aa001fe6c762873.tar.gz wekan-e5949504b7ed42ad59742d2a0aa001fe6c762873.tar.bz2 wekan-e5949504b7ed42ad59742d2a0aa001fe6c762873.zip |
models: cards: an empty string in members or label deletes the list
There is currently no way to remove all members or all labels attached
to a card. If an empty string is provided, we can consider as a hint to
remove the list from the card.
-rw-r--r-- | models/cards.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/models/cards.js b/models/cards.js index a9745f92..bcd16ece 100644 --- a/models/cards.js +++ b/models/cards.js @@ -1459,7 +1459,12 @@ if (Meteor.isServer) { if (req.body.hasOwnProperty('labelIds')) { let newlabelIds = req.body.labelIds; if (_.isString(newlabelIds)) { - newlabelIds = [newlabelIds]; + if (newlabelIds === '') { + newlabelIds = null; + } + else { + newlabelIds = [newlabelIds]; + } } Cards.direct.update({ _id: paramCardId, @@ -1520,7 +1525,12 @@ if (Meteor.isServer) { if (req.body.hasOwnProperty('members')) { let newmembers = req.body.members; if (_.isString(newmembers)) { - newmembers = [newmembers]; + if (newmembers === '') { + newmembers = null; + } + else { + newmembers = [newmembers]; + } } Cards.direct.update({_id: paramCardId, listId: paramListId, boardId: paramBoardId, archived: false}, {$set: {members: newmembers}}); |