mirror of
https://github.com/wekan/wekan.git
synced 2025-12-24 03:10:12 +01:00
models: cards: allow singletons to be assigned to members and labelIds
If we need to set only one member or one label, the data provided will not give us an array, but the only element as a string. We need to detect that and convert the parameter into an array.
This commit is contained in:
parent
6d4ffdd8b4
commit
2ce1ba37a1
1 changed files with 8 additions and 2 deletions
|
|
@ -1457,7 +1457,10 @@ if (Meteor.isServer) {
|
|||
});
|
||||
}
|
||||
if (req.body.hasOwnProperty('labelIds')) {
|
||||
const newlabelIds = req.body.labelIds;
|
||||
let newlabelIds = req.body.labelIds;
|
||||
if (_.isString(newlabelIds)) {
|
||||
newlabelIds = [newlabelIds];
|
||||
}
|
||||
Cards.direct.update({
|
||||
_id: paramCardId,
|
||||
listId: paramListId,
|
||||
|
|
@ -1515,7 +1518,10 @@ if (Meteor.isServer) {
|
|||
{$set: {customFields: newcustomFields}});
|
||||
}
|
||||
if (req.body.hasOwnProperty('members')) {
|
||||
const newmembers = req.body.members;
|
||||
let newmembers = req.body.members;
|
||||
if (_.isString(newmembers)) {
|
||||
newmembers = [newmembers];
|
||||
}
|
||||
Cards.direct.update({_id: paramCardId, listId: paramListId, boardId: paramBoardId, archived: false},
|
||||
{$set: {members: newmembers}});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue