summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>2018-06-27 16:44:58 +0200
committerBenjamin Tissoires <benjamin.tissoires@redhat.com>2018-10-24 16:55:33 +0200
commite5949504b7ed42ad59742d2a0aa001fe6c762873 (patch)
tree18f115a627153724c648da8b27b7f8e551d44c3b /models
parent2ce1ba37a1d0a09f8b3d2a1db4c8a11d1f98caa0 (diff)
downloadwekan-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.
Diffstat (limited to 'models')
-rw-r--r--models/cards.js14
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}});