From 6e9bad57723919dc3fd63a5748902e9049320603 Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Tue, 22 Jan 2019 23:35:12 +0100 Subject: IFTTT: card colors: add an actual white entry To unset the color through the IFTTT, we need a white entry. However, we do not want to show the white enry in the hamburger `Set Color` entry. We can also give the `white` capability to the API, it won't hurt and be more straightforward. --- models/cards.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'models/cards.js') diff --git a/models/cards.js b/models/cards.js index c5d9bf05..9b32e89a 100644 --- a/models/cards.js +++ b/models/cards.js @@ -69,7 +69,7 @@ Cards.attachSchema(new SimpleSchema({ type: String, optional: true, allowedValues: [ - 'green', 'yellow', 'orange', 'red', 'purple', + 'white', 'green', 'yellow', 'orange', 'red', 'purple', 'blue', 'sky', 'lime', 'pink', 'black', 'silver', 'peachpuff', 'crimson', 'plum', 'darkgreen', 'slateblue', 'magenta', 'gold', 'navy', 'gray', @@ -1571,13 +1571,16 @@ if (Meteor.isServer) { * * @description Edit a card * - * The color has to be chosen between `green`, `yellow`, `orange`, `red`, - * `purple`, `blue`, `sky`, `lime`, `pink`, `black`, `silver`, `peachpuff`, - * `crimson`, `plum`, `darkgreen`, `slateblue`, `magenta`, `gold`, `navy`, - * `gray`, `saddlebrown`, `paleturquoise`, `mistyrose`, `indigo`: + * The color has to be chosen between `white`, `green`, `yellow`, `orange`, + * `red`, `purple`, `blue`, `sky`, `lime`, `pink`, `black`, `silver`, + * `peachpuff`, `crimson`, `plum`, `darkgreen`, `slateblue`, `magenta`, + * `gold`, `navy`, `gray`, `saddlebrown`, `paleturquoise`, `mistyrose`, + * `indigo`: * * Wekan card colors * + * Note: setting the color to white has the same effect than removing it. + * * @param {string} boardId the board ID of the card * @param {string} list the list ID of the card * @param {string} cardId the ID of the card -- cgit v1.2.3-1-g7c22 From 6c3dbc3c6f52a42ddbeeaec9bbfcc82c1c839f7d Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Fri, 25 Jan 2019 12:44:27 +0100 Subject: api: new_card: add the card at the end of the list If we keep the `0` value, the card might be inserted in the middle of the list, making it hard to find it later on. Always append the card at the end of the list by setting a sort value based on the number of cards in the list. --- models/cards.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'models/cards.js') diff --git a/models/cards.js b/models/cards.js index 9b32e89a..ff19a9a0 100644 --- a/models/cards.js +++ b/models/cards.js @@ -1526,6 +1526,10 @@ if (Meteor.isServer) { Authentication.checkUserId(req.userId); const paramBoardId = req.params.boardId; const paramListId = req.params.listId; + const currentCards = Cards.find({ + listId: paramListId, + archived: false, + }, { sort: ['sort'] }); const check = Users.findOne({ _id: req.body.authorId, }); @@ -1538,7 +1542,7 @@ if (Meteor.isServer) { description: req.body.description, userId: req.body.authorId, swimlaneId: req.body.swimlaneId, - sort: 0, + sort: currentCards.count(), members, }); JsonRoutes.sendResult(res, { -- cgit v1.2.3-1-g7c22