diff options
author | Angelo Gallarello <angelo.gallarell@gmail.com> | 2018-08-15 18:47:09 +0200 |
---|---|---|
committer | Angelo Gallarello <angelo.gallarell@gmail.com> | 2018-08-15 18:47:09 +0200 |
commit | 9b0eb0a9f1973e05df7199cf2bff7518f2fa98dc (patch) | |
tree | a8a8aac97c9c8103f30d9ec2cd0c4cb0c0fc2396 /models/triggers.js | |
parent | 93cc7f0232ee456aff07e456b9c4601264f47ab4 (diff) | |
download | wekan-9b0eb0a9f1973e05df7199cf2bff7518f2fa98dc.tar.gz wekan-9b0eb0a9f1973e05df7199cf2bff7518f2fa98dc.tar.bz2 wekan-9b0eb0a9f1973e05df7199cf2bff7518f2fa98dc.zip |
Almost full circle
Diffstat (limited to 'models/triggers.js')
-rw-r--r-- | models/triggers.js | 29 |
1 files changed, 1 insertions, 28 deletions
diff --git a/models/triggers.js b/models/triggers.js index f8dbb50d..660d8b94 100644 --- a/models/triggers.js +++ b/models/triggers.js @@ -39,34 +39,7 @@ Triggers.helpers({ return _.contains(this.labelIds, label._id); }); return cardLabels; - }}); - - - -if (Meteor.isServer) { - Meteor.startup(() => { - const rules = Triggers.findOne({}); - if(!rules){ - Triggers.insert({group: "cards", activityType: "moveCard","fromId":-1,"toId":-1 }); - } - }); -} - - - - Activities.after.insert((userId, doc) => { - const activity = Activities._transform(doc); - const matchedTriggers = Triggers.find({activityType: activity.activityType,fromId:activity.oldListId,toId:activity.listId}) - if(matchedTriggers.count() > 0){ - const card = activity.card(); - const oldTitle = card.title; - const fromListTitle = activity.oldList().title; - Cards.direct.update({_id: card._id, listId: card.listId, boardId: card.boardId, archived: false}, - {$set: {title: "[From "+fromListTitle +"] "+ oldTitle}}); - } - }); - - +}}); |