Import single card: map labels

This commit is contained in:
Xavier Priour 2015-10-14 10:54:42 +02:00 committed by Maxime Quandalle
parent 432c1ebb5d
commit 68518f5497
2 changed files with 41 additions and 12 deletions

View file

@ -92,6 +92,12 @@ Boards.helpers({
return _.where(this.members, {isActive: true});
},
getLabel(name, color) {
return this.labels.find((current) => {
return ((current.name === name) && (current.color === color));
});
},
labelIndex(labelId) {
return _.indexOf(_.pluck(this.labels, '_id'), labelId);
},
@ -293,8 +299,8 @@ if (Meteor.isServer) {
});
});
// If the user remove one label from a board, we cant to remove reference of
// this label in any card of this board.
// If the user removes a label from a board, we have to remove references to
// this label in all cards of the board.
Boards.after.update((userId, doc, fieldNames, modifier) => {
if (!_.contains(fieldNames, 'labels') ||
!modifier.$pull ||