Browse Source

Labels activities

Angelo Gallarello 6 years ago
parent
commit
9c6d374b95

+ 2 - 2
RASD.txt

@@ -3,12 +3,12 @@ Rules
 	Triggers
 	Triggers
 
 
 		Board: create card, card moved to, card moved from
 		Board: create card, card moved to, card moved from
-		Card: [label, attachement, person ] added/removed, name starts with
+		Card: [label, attachment, person ] added/removed, name starts with
 		Checklists : checklist added/removed, check item checked/unchecked, checklist completed
 		Checklists : checklist added/removed, check item checked/unchecked, checklist completed
 
 
 	Actions
 	Actions
 		Board: move card to list, move to top/bottom, archive/unarchive
 		Board: move card to list, move to top/bottom, archive/unarchive
-		Card: [label, attachement, person ] add/remove, set title/description
+		Card: [label, attachment, person ] add/remove, set title/description
 		Checklists : checklist add/remove, check/uncheck item 
 		Checklists : checklist add/remove, check/uncheck item 
 		Mail: send email to
 		Mail: send email to
 		
 		

+ 7 - 0
client/components/activities/activities.jade

@@ -89,6 +89,13 @@ template(name="boardActivities")
         if($eq activityType 'restoredCard')
         if($eq activityType 'restoredCard')
           | {{{_ 'activity-sent' cardLink boardLabel}}}.
           | {{{_ 'activity-sent' cardLink boardLabel}}}.
 
 
+        if($eq activityType 'addedLabel')
+          | {{{_ 'activity-added-label' lastLabel cardLink}}}.
+
+        if($eq activityType 'removedLabel')
+          | {{{_ 'activity-removed-label' lastLabel cardLink}}}.
+
+
         if($eq activityType 'unjoinMember')
         if($eq activityType 'unjoinMember')
           if($eq user._id member._id)
           if($eq user._id member._id)
             | {{{_ 'activity-unjoined' cardLink}}}.
             | {{{_ 'activity-unjoined' cardLink}}}.

+ 13 - 0
client/components/activities/activities.js

@@ -58,6 +58,19 @@ BlazeComponent.extendComponent({
     }, card.title));
     }, card.title));
   },
   },
 
 
+  lastLabel(){
+    const lastLabelId = this.currentData().labelId;
+    const lastLabel = Boards.findOne(Session.get('currentBoard')).getLabelById(lastLabelId);
+    console.log("LAST");
+    console.log(lastLabel);
+
+    if(lastLabel.name == undefined || lastLabel.name == ""){
+      return lastLabel.color;
+    }else{
+      return lastLabel.name;
+    }
+  },
+
   listLabel() {
   listLabel() {
     return this.currentData().list().title;
     return this.currentData().list().title;
   },
   },

+ 1 - 1
client/components/boards/boardHeader.js

@@ -109,7 +109,7 @@ BlazeComponent.extendComponent({
         Sidebar.setView('search');
         Sidebar.setView('search');
       },
       },
       'click .js-open-rules-view'() {
       'click .js-open-rules-view'() {
-        Modal.open('rulesMain');
+        Modal.openWide('rulesMain');
       },
       },
       'click .js-multiselection-activate'() {
       'click .js-multiselection-activate'() {
         const currentCard = Session.get('currentCard');
         const currentCard = Session.get('currentCard');

+ 12 - 5
client/components/main/layouts.jade

@@ -35,11 +35,18 @@ template(name="defaultLayout")
   if (Modal.isOpen)
   if (Modal.isOpen)
     #modal
     #modal
       .overlay
       .overlay
-      .modal-content
-        a.modal-close-btn.js-close-modal
-          i.fa.fa-times-thin
-        +Template.dynamic(template=Modal.getHeaderName)
-        +Template.dynamic(template=Modal.getTemplateName)
+      if (Modal.isWide)
+        .modal-content-wide.modal-container
+          a.modal-close-btn.js-close-modal
+            i.fa.fa-times-thin
+          +Template.dynamic(template=Modal.getHeaderName)
+          +Template.dynamic(template=Modal.getTemplateName)
+      else
+        .modal-content.modal-container
+          a.modal-close-btn.js-close-modal
+            i.fa.fa-times-thin
+          +Template.dynamic(template=Modal.getHeaderName)
+          +Template.dynamic(template=Modal.getTemplateName)
 
 
 template(name="notFound")
 template(name="notFound")
   +message(label='page-not-found')
   +message(label='page-not-found')

+ 17 - 0
client/components/main/layouts.styl

@@ -61,6 +61,23 @@ body
       display: block
       display: block
       float: right
       float: right
       font-size: 24px
       font-size: 24px
+  
+  .modal-content-wide
+    width: 800px
+    min-height: 160px
+    margin: 42px auto
+    padding: 12px
+    border-radius: 4px
+    background: darken(white, 13%)
+    z-index: 110
+
+    h2
+      margin-bottom: 25px
+
+    .modal-close-btn
+      display: block
+      float: right
+      font-size: 24px
 
 
 h1
 h1
   font-size: 22px
   font-size: 22px

+ 0 - 3
client/components/rules/rules.styl

@@ -138,6 +138,3 @@
             transform: translate(-50%,-50%)
             transform: translate(-50%,-50%)
           &:hover, &.is-active
           &:hover, &.is-active
             box-shadow: 0 0 0 2px darken(white, 60%) inset
             box-shadow: 0 0 0 2px darken(white, 60%) inset
-              
-
-

+ 1 - 1
client/components/rules/rulesTriggers.jade

@@ -1,7 +1,7 @@
 template(name="rulesTriggers")
 template(name="rulesTriggers")
   h2
   h2
     i.fa.fa-cutlery
     i.fa.fa-cutlery
-    | Rule "#{data.ruleName}" - Add trigger
+    | Rule "#{data.ruleName.get}" - Add trigger
   .triggers-content
   .triggers-content
     .triggers-body
     .triggers-body
       .triggers-side-menu
       .triggers-side-menu

+ 26 - 10
client/components/rules/triggers/boardTriggers.jade

@@ -4,7 +4,7 @@ template(name="boardTriggers")
       div.trigger-text 
       div.trigger-text 
         | When a card is
         | When a card is
       div.trigger-dropdown
       div.trigger-dropdown
-        select(id="action")
+        select(id="gen-action")
           option(value="created") Added to
           option(value="created") Added to
           option(value="removed") Removed from
           option(value="removed") Removed from
       div.trigger-text 
       div.trigger-text 
@@ -17,13 +17,29 @@ template(name="boardTriggers")
       div.trigger-text 
       div.trigger-text 
         | When a card is
         | When a card is
       div.trigger-dropdown
       div.trigger-dropdown
-        select
-          option Moved to
+        select(id="create-action")
+          option(value="created") Added to
+          option(value="removed") Removed from
+      div.trigger-text 
+        | list
+      div.trigger-dropdown
+        input(id="create-list-name",type=text,placeholder="List Name")  
+    div.trigger-button.js-add-create-trigger.js-goto-action
+      i.fa.fa-plus
+
+  div.trigger-item
+    div.trigger-content
+      div.trigger-text 
+        | When a card is
+      div.trigger-dropdown
+        select(id="move-action")
+          option(value="moved-to") Moved to
+          option(value="moved-from") Moved from
       div.trigger-text 
       div.trigger-text 
-        | to list
+        | list
       div.trigger-dropdown
       div.trigger-dropdown
-        input(type=text,placeholder="List Name")  
-    div.trigger-button.js-add-spec-trigger.js-goto-action
+        input(id="move-list-name",type=text,placeholder="List Name")  
+    div.trigger-button.js-add-moved-trigger.js-goto-action
       i.fa.fa-plus
       i.fa.fa-plus
 
 
   div.trigger-item
   div.trigger-item
@@ -31,10 +47,10 @@ template(name="boardTriggers")
       div.trigger-text 
       div.trigger-text 
         | When a card is
         | When a card is
       div.trigger-dropdown
       div.trigger-dropdown
-        select
-          option Archived
-          option Unarchived
-    div.trigger-button.js-add-arc-trigger.js-goto-action
+        select(id="arch-action")
+          option(value="archived") Archived
+          option(value="unarchived") Unarchived
+    div.trigger-button.js-add-arch-trigger.js-goto-action
       i.fa.fa-plus
       i.fa.fa-plus
 
 
 
 

+ 65 - 1
client/components/rules/triggers/boardTriggers.js

@@ -8,7 +8,7 @@ BlazeComponent.extendComponent({
     {'click .js-add-gen-trigger'(event) {
     {'click .js-add-gen-trigger'(event) {
 
 
       let datas = this.data();
       let datas = this.data();
-      const actionSelected = this.find('#action').value;
+      const actionSelected = this.find('#gen-action').value;
       const boardId = Session.get('currentBoard')
       const boardId = Session.get('currentBoard')
       if(actionSelected == "created"){
       if(actionSelected == "created"){
         Triggers.insert({activityType: "createCard","boardId":boardId,"listId":"*"},function(error,id){
         Triggers.insert({activityType: "createCard","boardId":boardId,"listId":"*"},function(error,id){
@@ -20,8 +20,72 @@ BlazeComponent.extendComponent({
           datas.triggerIdVar.set(id);
           datas.triggerIdVar.set(id);
         });
         });
       }
       }
+    },
+    'click .js-add-create-trigger'(event) {
 
 
+      let datas = this.data();
+      const actionSelected = this.find('#create-action').value;
+      const listName = this.find('#create-list-name').value;
+      const boardId = Session.get('currentBoard')
+      const list = Lists.findOne({title:listName});
+      let listId;
+      if(list == undefined){
+        listId = "*"
+      }else{
+        listId = list._id;
+      }
+      if(actionSelected == "created"){
+        Triggers.insert({activityType: "createCard","boardId":boardId,"listId":listId},function(error,id){
+          datas.triggerIdVar.set(id);
+        });
+      }
+      if(actionSelected == "removed"){
+        Triggers.insert({activityType: "removeCard","boardId":boardId,"listId":listId},function(error,id){
+          datas.triggerIdVar.set(id);
+        });
+      }
     },
     },
+    'click .js-add-moved-trigger'(event) {
+      let datas = this.data();
+      const actionSelected = this.find('#move-action').value;
+      const listName = this.find('#move-list-name').value;
+      const boardId = Session.get('currentBoard')
+      const list = Lists.findOne({title:listName});
+      console.log(list);
+      let listId;
+      if(list == undefined){
+        listId = "*"
+      }else{
+        listId = list._id;
+      }
+      console.log(listId);
+      if(actionSelected == "moved-to"){
+        Triggers.insert({activityType: "moveCard","boardId":boardId,"listId":listId,"oldListId":"*"},function(error,id){
+          datas.triggerIdVar.set(id);
+        });
+      }
+      if(actionSelected == "moved-from"){
+        Triggers.insert({activityType: "moveCard","boardId":boardId,"listId":"*","oldListId":listId},function(error,id){
+          datas.triggerIdVar.set(id);
+        });
+      }
+    },
+    'click .js-add-arc-trigger'(event) {
+      let datas = this.data();
+      const actionSelected = this.find('#arch-action').value;
+      const boardId = Session.get('currentBoard')
+      if(actionSelected == "archived"){
+        Triggers.insert({activityType: "archivedCard","boardId":boardId},function(error,id){
+          datas.triggerIdVar.set(id);
+        });
+      }
+      if(actionSelected == "unarchived"){
+        Triggers.insert({activityType: "restoredCard","boardId":boardId},function(error,id){
+          datas.triggerIdVar.set(id);
+        });
+      }
+    }
+
     }];
     }];
   },
   },
 
 

+ 72 - 3
client/components/rules/triggers/cardTriggers.jade

@@ -4,7 +4,76 @@ template(name="cardTriggers")
       div.trigger-text 
       div.trigger-text 
         | When a label is
         | When a label is
       div.trigger-dropdown
       div.trigger-dropdown
-        select
-          option Moved to
-    div.trigger-button
+        select(id="create-action")
+          option(value="created") Added to
+          option(value="removed") Removed from
+      div.trigger-text 
+        | a card 
+    div.trigger-button.js-add-gen-label-trigger.js-goto-action
+      i.fa.fa-plus
+
+  div.trigger-item
+    div.trigger-content
+      div.trigger-text 
+        | When the label
+      div.trigger-dropdown
+        select(id="label")
+          each labels
+            option
+              = name
+      div.trigger-text 
+        | is
+      div.trigger-dropdown
+        select(id="create-action")
+          option(value="created") Added to
+          option(value="removed") Removed from
+      div.trigger-text 
+        | a card 
+    div.trigger-button.js-add-label-trigger.js-goto-action
+      i.fa.fa-plus
+
+  div.trigger-item
+    div.trigger-content
+      div.trigger-text 
+        | When a member is
+      div.trigger-dropdown
+        select(id="create-action")
+          option(value="created") Added to
+          option(value="removed") Removed from
+      div.trigger-text 
+        | a card 
+    div.trigger-button.js-add-gen.member-trigger.js-goto-action
+      i.fa.fa-plus
+
+
+  div.trigger-item
+    div.trigger-content
+      div.trigger-text 
+        | When the member
+      div.trigger-dropdown
+        input(id="create-list-name",type=text,placeholder="name") 
+      div.trigger-text 
+        | is
+      div.trigger-dropdown
+        select(id="create-action")
+          option(value="created") Added to
+          option(value="removed") Removed from
+      div.trigger-text 
+        | a card 
+    div.trigger-button.js-add-member-trigger.js-goto-action
+      i.fa.fa-plus
+
+  div.trigger-item
+    div.trigger-content
+      div.trigger-text 
+        | When an attachment
+      div.trigger-text 
+        | is
+      div.trigger-dropdown
+        select(id="create-action")
+          option(value="created") Added to
+          option(value="removed") Removed from
+      div.trigger-text 
+        | a card 
+    div.trigger-button.js-add-attachment-trigger.js-goto-action
       i.fa.fa-plus
       i.fa.fa-plus

+ 105 - 0
client/components/rules/triggers/cardTriggers.js

@@ -0,0 +1,105 @@
+BlazeComponent.extendComponent({
+  onCreated() {
+    this.subscribe('allRules');
+  },
+
+  labels(){
+    const labels = Boards.findOne(Session.get('currentBoard')).labels;
+    console.log(labels);
+    for(let i = 0;i<labels.length;i++){
+      if(labels[i].name == "" || labels[i].name == undefined){
+        labels[i].name = labels[i].color.toUpperCase();
+      }
+    }
+    console.log(labels);
+    return labels;
+  },
+  events() {
+    return [
+    {'click .js-add-gen-trigger'(event) {
+
+      let datas = this.data();
+      const actionSelected = this.find('#gen-action').value;
+      const boardId = Session.get('currentBoard')
+      if(actionSelected == "created"){
+        Triggers.insert({activityType: "createCard","boardId":boardId,"listId":"*"},function(error,id){
+          datas.triggerIdVar.set(id);
+        });
+      }
+      if(actionSelected == "removed"){
+        Triggers.insert({activityType: "removeCard","boardId":boardId},function(error,id){
+          datas.triggerIdVar.set(id);
+        });
+      }
+    },
+    'click .js-add-create-trigger'(event) {
+
+      let datas = this.data();
+      const actionSelected = this.find('#create-action').value;
+      const listName = this.find('#create-list-name').value;
+      const boardId = Session.get('currentBoard')
+      const list = Lists.findOne({title:listName});
+      let listId;
+      if(list == undefined){
+        listId = "*"
+      }else{
+        listId = list._id;
+      }
+      if(actionSelected == "created"){
+        Triggers.insert({activityType: "createCard","boardId":boardId,"listId":listId},function(error,id){
+          datas.triggerIdVar.set(id);
+        });
+      }
+      if(actionSelected == "removed"){
+        Triggers.insert({activityType: "removeCard","boardId":boardId,"listId":listId},function(error,id){
+          datas.triggerIdVar.set(id);
+        });
+      }
+    },
+    'click .js-add-moved-trigger'(event) {
+      let datas = this.data();
+      const actionSelected = this.find('#move-action').value;
+      const listName = this.find('#move-list-name').value;
+      const boardId = Session.get('currentBoard')
+      const list = Lists.findOne({title:listName});
+      console.log(list);
+      let listId;
+      if(list == undefined){
+        listId = "*"
+      }else{
+        listId = list._id;
+      }
+      console.log(listId);
+      if(actionSelected == "moved-to"){
+        Triggers.insert({activityType: "moveCard","boardId":boardId,"listId":listId,"oldListId":"*"},function(error,id){
+          datas.triggerIdVar.set(id);
+        });
+      }
+      if(actionSelected == "moved-from"){
+        Triggers.insert({activityType: "moveCard","boardId":boardId,"listId":"*","oldListId":listId},function(error,id){
+          datas.triggerIdVar.set(id);
+        });
+      }
+    },
+    'click .js-add-arc-trigger'(event) {
+      let datas = this.data();
+      const actionSelected = this.find('#arch-action').value;
+      const boardId = Session.get('currentBoard')
+      if(actionSelected == "archived"){
+        Triggers.insert({activityType: "archivedCard","boardId":boardId},function(error,id){
+          datas.triggerIdVar.set(id);
+        });
+      }
+      if(actionSelected == "unarchived"){
+        Triggers.insert({activityType: "restoredCard","boardId":boardId},function(error,id){
+          datas.triggerIdVar.set(id);
+        });
+      }
+    }
+
+    }];
+  },
+
+}).register('cardTriggers');
+
+

+ 77 - 4
client/components/rules/triggers/checklistTriggers.jade

@@ -2,9 +2,82 @@ template(name="checklistTriggers")
   div.trigger-item
   div.trigger-item
     div.trigger-content
     div.trigger-content
       div.trigger-text 
       div.trigger-text 
-        | When a check is
+        | When a checklist is
       div.trigger-dropdown
       div.trigger-dropdown
-        select
-          option Checked
-    div.trigger-button
+        select(id="create-action")
+          option(value="created") Added to
+          option(value="removed") Removed from
+      div.trigger-text 
+        | a card 
+    div.trigger-button.js-add-gen.member-trigger.js-goto-action
+      i.fa.fa-plus
+
+
+  div.trigger-item
+    div.trigger-content
+      div.trigger-text 
+        | When the checklist
+      div.trigger-dropdown
+        input(id="create-list-name",type=text,placeholder="Name") 
+      div.trigger-text 
+        | is
+      div.trigger-dropdown
+        select(id="create-action")
+          option(value="created") Added to
+          option(value="removed") Removed from
+      div.trigger-text 
+        | a card 
+    div.trigger-button.js-add-checklist-trigger.js-goto-action
+      i.fa.fa-plus
+
+  div.trigger-item
+    div.trigger-content
+      div.trigger-text 
+        | When a checklist is
+      div.trigger-dropdown
+        select(id="create-action")
+          option(value="created") Completed
+          option(value="removed") Made incomplete
+    div.trigger-button.js-add-gen.member-trigger.js-goto-action
+      i.fa.fa-plus
+
+  div.trigger-item
+    div.trigger-content
+      div.trigger-text 
+        | When the checklist
+      div.trigger-dropdown
+        input(id="create-list-name",type=text,placeholder="Name") 
+      div.trigger-text 
+        | is
+      div.trigger-dropdown
+        select(id="create-action")
+          option(value="created") Completed
+          option(value="removed") Made incomplete
+    div.trigger-button.js-add-checklist-trigger.js-goto-action
+      i.fa.fa-plus
+
+  div.trigger-item
+    div.trigger-content
+      div.trigger-text 
+        | When a checklist item is
+      div.trigger-dropdown
+        select(id="create-action")
+          option(value="created") Checked
+          option(value="removed") Unchecked
+    div.trigger-button.js-add-gen.member-trigger.js-goto-action
+      i.fa.fa-plus
+
+  div.trigger-item
+    div.trigger-content
+      div.trigger-text 
+        | When the checklist item 
+      div.trigger-dropdown
+        input(id="create-list-name",type=text,placeholder="Name") 
+      div.trigger-text 
+        | is
+      div.trigger-dropdown
+        select(id="create-action")
+          option(value="created") Checked
+          option(value="removed") Unchecked
+    div.trigger-button.js-add-checklist-trigger.js-goto-action
       i.fa.fa-plus
       i.fa.fa-plus

+ 13 - 1
client/lib/modal.js

@@ -4,6 +4,7 @@ window.Modal = new class {
   constructor() {
   constructor() {
     this._currentModal = new ReactiveVar(closedValue);
     this._currentModal = new ReactiveVar(closedValue);
     this._onCloseGoTo = '';
     this._onCloseGoTo = '';
+    this._isWideModal = false;
   }
   }
 
 
   getHeaderName() {
   getHeaderName() {
@@ -20,6 +21,10 @@ window.Modal = new class {
     return this.getTemplateName() !== closedValue;
     return this.getTemplateName() !== closedValue;
   }
   }
 
 
+  isWide(){
+    return this._isWideModal;
+  }
+
   close() {
   close() {
     this._currentModal.set(closedValue);
     this._currentModal.set(closedValue);
     if (this._onCloseGoTo) {
     if (this._onCloseGoTo) {
@@ -27,9 +32,16 @@ window.Modal = new class {
     }
     }
   }
   }
 
 
+  openWide(modalName, { header = '', onCloseGoTo = ''} = {}) {
+    this._currentModal.set({ header, modalName });
+    this._onCloseGoTo = onCloseGoTo;
+    this._isWideModal = true;
+  }
+
   open(modalName, { header = '', onCloseGoTo = ''} = {}) {
   open(modalName, { header = '', onCloseGoTo = ''} = {}) {
     this._currentModal.set({ header, modalName });
     this._currentModal.set({ header, modalName });
     this._onCloseGoTo = onCloseGoTo;
     this._onCloseGoTo = onCloseGoTo;
+
   }
   }
 }();
 }();
 
 
@@ -38,5 +50,5 @@ Blaze.registerHelper('Modal', Modal);
 EscapeActions.register('modalWindow',
 EscapeActions.register('modalWindow',
   () => Modal.close(),
   () => Modal.close(),
   () => Modal.isOpen(),
   () => Modal.isOpen(),
-  { noClickEscapeOn: '.modal-content' }
+  { noClickEscapeOn: '.modal-container' }
 );
 );

+ 3 - 1
i18n/en.i18n.json

@@ -499,6 +499,8 @@
     "change-card-parent": "Change card's parent",
     "change-card-parent": "Change card's parent",
     "parent-card": "Parent card",
     "parent-card": "Parent card",
     "source-board": "Source board",
     "source-board": "Source board",
-    "no-parent": "Don't show parent"
+    "no-parent": "Don't show parent",
+    "activity-added-label": "added label '%s' to %s",
+    "activity-removed-label": "removed label '%s' from %s"
 
 
 }
 }

+ 4 - 0
models/boards.js

@@ -254,6 +254,10 @@ Boards.helpers({
     return _.findWhere(this.labels, { name, color });
     return _.findWhere(this.labels, { name, color });
   },
   },
 
 
+  getLabelById(labelId){
+    return _.findWhere(this.labels, { _id: labelId });
+  },
+
   labelIndex(labelId) {
   labelIndex(labelId) {
     return _.pluck(this.labels, '_id').indexOf(labelId);
     return _.pluck(this.labels, '_id').indexOf(labelId);
   },
   },

+ 41 - 0
models/cards.js

@@ -624,6 +624,41 @@ function cardMembers(userId, doc, fieldNames, modifier) {
   }
   }
 }
 }
 
 
+function cardLabels(userId, doc, fieldNames, modifier) {
+  if (!_.contains(fieldNames, 'labelIds'))
+    return;
+  let labelId;
+  // Say hello to the new label
+  if (modifier.$addToSet && modifier.$addToSet.labelIds) {
+    labelId = modifier.$addToSet.labelIds;
+    if (!_.contains(doc.labelIds, labelId)) {
+      const act = {
+        userId,
+        labelId,
+        activityType: 'addedLabel',
+        boardId: doc.boardId,
+        cardId: doc._id,
+      }
+      Activities.insert(act);
+    }
+  }
+
+  // Say goodbye to the label
+  if (modifier.$pull && modifier.$pull.labelIds) {
+    labelId = modifier.$pull.labelIds;
+    // Check that the former member is member of the card
+    if (_.contains(doc.labelIds, labelId)) {
+      Activities.insert({
+        userId,
+        labelId,
+        activityType: 'removedLabel',
+        boardId: doc.boardId,
+        cardId: doc._id,
+      });
+    }
+  }
+}
+
 function cardCreation(userId, doc) {
 function cardCreation(userId, doc) {
   Activities.insert({
   Activities.insert({
     userId,
     userId,
@@ -680,6 +715,12 @@ if (Meteor.isServer) {
     cardMembers(userId, doc, fieldNames, modifier);
     cardMembers(userId, doc, fieldNames, modifier);
   });
   });
 
 
+  // Add a new activity if we add or remove a label to the card
+  Cards.before.update((userId, doc, fieldNames, modifier) => {
+    cardLabels(userId, doc, fieldNames, modifier);
+  });
+
+
   // Remove all activities associated with a card if we remove the card
   // Remove all activities associated with a card if we remove the card
   // Remove also card_comments / checklists / attachments
   // Remove also card_comments / checklists / attachments
   Cards.after.remove((userId, doc) => {
   Cards.after.remove((userId, doc) => {

+ 3 - 0
server/rulesHelper.js

@@ -20,6 +20,9 @@ RulesHelper = {
 	},
 	},
 	findMatchingRules(activity){
 	findMatchingRules(activity){
 		const activityType = activity.activityType;
 		const activityType = activity.activityType;
+		if(TriggersDef[activityType] == undefined){
+			return [];
+		}
 		const matchingFields = TriggersDef[activityType].matchingFields;
 		const matchingFields = TriggersDef[activityType].matchingFields;
 		const matchingMap = this.buildMatchingFieldsMap(activity,matchingFields);
 		const matchingMap = this.buildMatchingFieldsMap(activity,matchingFields);
 		let matchingTriggers = Triggers.find(matchingMap);
 		let matchingTriggers = Triggers.find(matchingMap);

+ 17 - 27
server/triggersDef.js

@@ -1,39 +1,29 @@
 TriggersDef = {
 TriggersDef = {
 	createCard:{
 	createCard:{
-		matchingFields: ["boardId","listId"]
+		matchingFields: ["boardId", "listId"]
 	},
 	},
 	moveCard:{
 	moveCard:{
-		matchingFields: ["boardId","listId","oldListId"]
+		matchingFields: ["boardId", "listId", "oldListId"]
 	},
 	},
 	archivedCard:{
 	archivedCard:{
 		matchingFields: ["boardId"]
 		matchingFields: ["boardId"]
+	},
+	restoredCard:{
+		matchingFields: ["boardId"]
+	},
+	joinMember:{
+		matchingFields: ["boardId","memberId"]
+	},
+	unJoinMember:{
+		matchingFields: ["boardId","memberId"]
+	},
+	addChecklist:{
+		matchingFields: ["boardId","checklistId"]
+	},
+	addChecklistItem:{
+		matchingFields: ["boardId","checklistItemId"]
 	}
 	}
 }
 }
 
 
 
 
-		// if(activityType == "createCard"){
-
-		// }
-		// if(activityType == "moveCard"){
-
-		// }
-		// if(activityType == "archivedCard"){
-
-		// }
-		// if(activityType == "restoredCard"){
-			
-		// }
-		// if(activityType == "joinMember"){
-
-		// }
-		// if(activityType == "unJoinMember"){
-			
-		// }
-		// if(activityType == "addChecklist"){
-			
-		// }
-		// if(activityType == "addChecklistItem"){
-			
-		// }
-