summaryrefslogtreecommitdiffstats
path: root/models/trelloCreator.js
diff options
context:
space:
mode:
authorRomulus Tsai 蔡仲明 <urakagi@gmail.com>2020-05-08 10:13:11 +0800
committerRomulus Tsai 蔡仲明 <urakagi@gmail.com>2020-05-08 10:13:11 +0800
commitc3458855bdb52c976ee6689ad5a0d4e92e96f2e3 (patch)
treed9dbbcc3087b5bfc520710b5f5624a3f4e2b78e6 /models/trelloCreator.js
parent444848876759173ad80203129250d2f0311f30fc (diff)
parentcfcc73724fcd394150d1b815d0a7a4c466e216b5 (diff)
downloadwekan-c3458855bdb52c976ee6689ad5a0d4e92e96f2e3.tar.gz
wekan-c3458855bdb52c976ee6689ad5a0d4e92e96f2e3.tar.bz2
wekan-c3458855bdb52c976ee6689ad5a0d4e92e96f2e3.zip
Merge branch 'master' into lib-change
Diffstat (limited to 'models/trelloCreator.js')
-rw-r--r--models/trelloCreator.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/models/trelloCreator.js b/models/trelloCreator.js
index b38e4652..c4be140b 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