diff options
author | Unknown <unknown@example.com> | 2020-07-21 17:36:46 +0200 |
---|---|---|
committer | Unknown <unknown@example.com> | 2020-07-21 17:36:46 +0200 |
commit | 95522ebcd9100340a8d56a77103ec163185f6d05 (patch) | |
tree | d77c8e631adeb2ac02412c29b7f1cef41f795316 | |
parent | 8bf13f43e8a3cb143f429d1f49ce761b303982df (diff) | |
download | wekan-95522ebcd9100340a8d56a77103ec163185f6d05.tar.gz wekan-95522ebcd9100340a8d56a77103ec163185f6d05.tar.bz2 wekan-95522ebcd9100340a8d56a77103ec163185f6d05.zip |
changed edit_card and get_card_by_customfields
There was a bug in edit_card API: If I call API to edit listid and some fields It modifies only the listid. In addiction I've modified get_card_by_customfield to return full documents.
-rw-r--r-- | models/cards.js | 66 | ||||
-rw-r--r-- | models/users.js | 6 |
2 files changed, 32 insertions, 40 deletions
diff --git a/models/cards.js b/models/cards.js index 2fd52827..04d187b3 100644 --- a/models/cards.js +++ b/models/cards.js @@ -2420,34 +2420,6 @@ if (Meteor.isServer) { }, ); } - if (req.body.hasOwnProperty('listId')) { - const newParamListId = req.body.listId; - Cards.direct.update( - { - _id: paramCardId, - listId: paramListId, - boardId: paramBoardId, - archived: false, - }, - { - $set: { - listId: newParamListId, - }, - }, - ); - - const card = Cards.findOne({ - _id: paramCardId, - }); - cardMove( - req.body.authorId, - card, - { - fieldName: 'listId', - }, - paramListId, - ); - } if (req.body.hasOwnProperty('parentId')) { const newParentId = req.body.parentId; Cards.direct.update( @@ -2691,6 +2663,34 @@ if (Meteor.isServer) { { $set: { swimlaneId: newParamSwimlaneId } }, ); } + if (req.body.hasOwnProperty('listId')) { + const newParamListId = req.body.listId; + Cards.direct.update( + { + _id: paramCardId, + listId: paramListId, + boardId: paramBoardId, + archived: false, + }, + { + $set: { + listId: newParamListId, + }, + }, + ); + + const card = Cards.findOne({ + _id: paramCardId, + }); + cardMove( + req.body.authorId, + card, + { + fieldName: 'listId', + }, + paramListId, + ); + } JsonRoutes.sendResult(res, { code: 200, data: { @@ -2772,15 +2772,7 @@ if (Meteor.isServer) { }, }, archived: false, - }).map(function(doc) { - return { - _id: doc._id, - title: doc.title, - description: doc.description, - listId: doc.listId, - swinlaneId: doc.swinlaneId, - }; - }), + }).fetch(), }); }, ); diff --git a/models/users.js b/models/users.js index 7c5d2855..0ff9d017 100644 --- a/models/users.js +++ b/models/users.js @@ -1136,9 +1136,9 @@ if (Meteor.isServer) { */ const Future = require('fibers/future'); - let future1 = new Future(); - let future2 = new Future(); - let future3 = new Future(); + const future1 = new Future(); + const future2 = new Future(); + const future3 = new Future(); Boards.insert( { title: TAPi18n.__('templates'), |