diff options
author | Benjamin Tissoires <benjamin.tissoires@redhat.com> | 2019-01-25 10:57:46 +0100 |
---|---|---|
committer | Benjamin Tissoires <benjamin.tissoires@redhat.com> | 2019-01-25 11:04:56 +0100 |
commit | b5411841cf6aa33b2c0d29d85cbc795e3faa7f4f (patch) | |
tree | e4f9da788c14451f01bbbb0cc6dc10dd68d9f897 | |
parent | 5c6a725712a443b4d03b4f86262033ddfb66bc3d (diff) | |
download | wekan-b5411841cf6aa33b2c0d29d85cbc795e3faa7f4f.tar.gz wekan-b5411841cf6aa33b2c0d29d85cbc795e3faa7f4f.tar.bz2 wekan-b5411841cf6aa33b2c0d29d85cbc795e3faa7f4f.zip |
api: fix the sort field when inserting a swimlane or a list
This has the side effect of always inserting the element at the end.
-rw-r--r-- | models/lists.js | 2 | ||||
-rw-r--r-- | models/swimlanes.js | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/models/lists.js b/models/lists.js index 0e1ba801..39ff130a 100644 --- a/models/lists.js +++ b/models/lists.js @@ -314,9 +314,11 @@ if (Meteor.isServer) { try { Authentication.checkUserId( req.userId); const paramBoardId = req.params.boardId; + const board = Boards.findOne(paramBoardId); const id = Lists.insert({ title: req.body.title, boardId: paramBoardId, + sort: board.lists().count(), }); JsonRoutes.sendResult(res, { code: 200, diff --git a/models/swimlanes.js b/models/swimlanes.js index 93057362..e2c3925c 100644 --- a/models/swimlanes.js +++ b/models/swimlanes.js @@ -256,9 +256,11 @@ if (Meteor.isServer) { try { Authentication.checkUserId( req.userId); const paramBoardId = req.params.boardId; + const board = Boards.findOne(paramBoardId); const id = Swimlanes.insert({ title: req.body.title, boardId: paramBoardId, + sort: board.swimlanes().count(), }); JsonRoutes.sendResult(res, { code: 200, |