diff options
author | Romulus Tsai 蔡仲明 <urakagi@gmail.com> | 2020-05-08 09:35:11 +0800 |
---|---|---|
committer | Romulus Tsai 蔡仲明 <urakagi@gmail.com> | 2020-05-08 09:35:11 +0800 |
commit | cfcc73724fcd394150d1b815d0a7a4c466e216b5 (patch) | |
tree | a9648255f14cd8b0e1ad8eee1f8d42337a0668bc /models/trelloCreator.js | |
parent | a3658993128bdddd5d40f792c19281dc5eac51f5 (diff) | |
parent | 533bc045d06269dba2f42cdfe61817a1b3407974 (diff) | |
download | wekan-cfcc73724fcd394150d1b815d0a7a4c466e216b5.tar.gz wekan-cfcc73724fcd394150d1b815d0a7a4c466e216b5.tar.bz2 wekan-cfcc73724fcd394150d1b815d0a7a4c466e216b5.zip |
Merge branch 'master' of https://github.com/wekan/wekan
Diffstat (limited to 'models/trelloCreator.js')
-rw-r--r-- | models/trelloCreator.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/models/trelloCreator.js b/models/trelloCreator.js index cb1a6a67..1c5bcd93 100644 --- a/models/trelloCreator.js +++ b/models/trelloCreator.js @@ -285,6 +285,30 @@ export class TrelloCreator { cardToCreate.members = wekanMembers; } } + // add vote + if (card.idMembersVoted) { + // Trello only know's positive votes + const positiveVotes = []; + card.idMembersVoted.forEach(trelloId => { + if (this.members[trelloId]) { + const wekanId = this.members[trelloId]; + // we may map multiple Trello members to the same wekan user + // in which case we risk adding the same user multiple times + if (!positiveVotes.find(wId => wId === wekanId)) { + positiveVotes.push(wekanId); + } + } + return true; + }); + if (positiveVotes.length > 0) { + cardToCreate.vote = { + question: cardToCreate.title, + public: true, + positive: positiveVotes, + }; + } + } + // insert card const cardId = Cards.direct.insert(cardToCreate); // keep track of Trello id => Wekan id |