mirror of
https://github.com/wekan/wekan.git
synced 2025-09-22 01:50:48 +02:00
Labels activities
This commit is contained in:
parent
99e7c65907
commit
9c6d374b95
19 changed files with 480 additions and 60 deletions
4
RASD.txt
4
RASD.txt
|
@ -3,12 +3,12 @@ Rules
|
|||
Triggers
|
||||
|
||||
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
|
||||
|
||||
Actions
|
||||
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
|
||||
Mail: send email to
|
||||
|
||||
|
|
|
@ -89,6 +89,13 @@ template(name="boardActivities")
|
|||
if($eq activityType 'restoredCard')
|
||||
| {{{_ '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 user._id member._id)
|
||||
| {{{_ 'activity-unjoined' cardLink}}}.
|
||||
|
|
|
@ -58,6 +58,19 @@ BlazeComponent.extendComponent({
|
|||
}, 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() {
|
||||
return this.currentData().list().title;
|
||||
},
|
||||
|
|
|
@ -109,7 +109,7 @@ BlazeComponent.extendComponent({
|
|||
Sidebar.setView('search');
|
||||
},
|
||||
'click .js-open-rules-view'() {
|
||||
Modal.open('rulesMain');
|
||||
Modal.openWide('rulesMain');
|
||||
},
|
||||
'click .js-multiselection-activate'() {
|
||||
const currentCard = Session.get('currentCard');
|
||||
|
|
|
@ -35,11 +35,18 @@ template(name="defaultLayout")
|
|||
if (Modal.isOpen)
|
||||
#modal
|
||||
.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")
|
||||
+message(label='page-not-found')
|
||||
|
|
|
@ -61,6 +61,23 @@ body
|
|||
display: block
|
||||
float: right
|
||||
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
|
||||
font-size: 22px
|
||||
|
|
|
@ -138,6 +138,3 @@
|
|||
transform: translate(-50%,-50%)
|
||||
&:hover, &.is-active
|
||||
box-shadow: 0 0 0 2px darken(white, 60%) inset
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
template(name="rulesTriggers")
|
||||
h2
|
||||
i.fa.fa-cutlery
|
||||
| Rule "#{data.ruleName}" - Add trigger
|
||||
| Rule "#{data.ruleName.get}" - Add trigger
|
||||
.triggers-content
|
||||
.triggers-body
|
||||
.triggers-side-menu
|
||||
|
|
|
@ -4,7 +4,7 @@ template(name="boardTriggers")
|
|||
div.trigger-text
|
||||
| When a card is
|
||||
div.trigger-dropdown
|
||||
select(id="action")
|
||||
select(id="gen-action")
|
||||
option(value="created") Added to
|
||||
option(value="removed") Removed from
|
||||
div.trigger-text
|
||||
|
@ -17,13 +17,14 @@ template(name="boardTriggers")
|
|||
div.trigger-text
|
||||
| When a card is
|
||||
div.trigger-dropdown
|
||||
select
|
||||
option Moved to
|
||||
select(id="create-action")
|
||||
option(value="created") Added to
|
||||
option(value="removed") Removed from
|
||||
div.trigger-text
|
||||
| to list
|
||||
| list
|
||||
div.trigger-dropdown
|
||||
input(type=text,placeholder="List Name")
|
||||
div.trigger-button.js-add-spec-trigger.js-goto-action
|
||||
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
|
||||
|
@ -31,10 +32,25 @@ template(name="boardTriggers")
|
|||
div.trigger-text
|
||||
| When a card is
|
||||
div.trigger-dropdown
|
||||
select
|
||||
option Archived
|
||||
option Unarchived
|
||||
div.trigger-button.js-add-arc-trigger.js-goto-action
|
||||
select(id="move-action")
|
||||
option(value="moved-to") Moved to
|
||||
option(value="moved-from") Moved from
|
||||
div.trigger-text
|
||||
| list
|
||||
div.trigger-dropdown
|
||||
input(id="move-list-name",type=text,placeholder="List Name")
|
||||
div.trigger-button.js-add-moved-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="arch-action")
|
||||
option(value="archived") Archived
|
||||
option(value="unarchived") Unarchived
|
||||
div.trigger-button.js-add-arch-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
||||
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ BlazeComponent.extendComponent({
|
|||
{'click .js-add-gen-trigger'(event) {
|
||||
|
||||
let datas = this.data();
|
||||
const actionSelected = this.find('#action').value;
|
||||
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){
|
||||
|
@ -20,8 +20,72 @@ BlazeComponent.extendComponent({
|
|||
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}];
|
||||
},
|
||||
|
||||
|
|
|
@ -4,7 +4,76 @@ template(name="cardTriggers")
|
|||
div.trigger-text
|
||||
| When a label is
|
||||
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
|
105
client/components/rules/triggers/cardTriggers.js
Normal file
105
client/components/rules/triggers/cardTriggers.js
Normal file
|
@ -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');
|
||||
|
||||
|
|
@ -2,9 +2,82 @@ template(name="checklistTriggers")
|
|||
div.trigger-item
|
||||
div.trigger-content
|
||||
div.trigger-text
|
||||
| When a check is
|
||||
| When a checklist is
|
||||
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
|
|
@ -4,6 +4,7 @@ window.Modal = new class {
|
|||
constructor() {
|
||||
this._currentModal = new ReactiveVar(closedValue);
|
||||
this._onCloseGoTo = '';
|
||||
this._isWideModal = false;
|
||||
}
|
||||
|
||||
getHeaderName() {
|
||||
|
@ -20,6 +21,10 @@ window.Modal = new class {
|
|||
return this.getTemplateName() !== closedValue;
|
||||
}
|
||||
|
||||
isWide(){
|
||||
return this._isWideModal;
|
||||
}
|
||||
|
||||
close() {
|
||||
this._currentModal.set(closedValue);
|
||||
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 = ''} = {}) {
|
||||
this._currentModal.set({ header, modalName });
|
||||
this._onCloseGoTo = onCloseGoTo;
|
||||
|
||||
}
|
||||
}();
|
||||
|
||||
|
@ -38,5 +50,5 @@ Blaze.registerHelper('Modal', Modal);
|
|||
EscapeActions.register('modalWindow',
|
||||
() => Modal.close(),
|
||||
() => Modal.isOpen(),
|
||||
{ noClickEscapeOn: '.modal-content' }
|
||||
{ noClickEscapeOn: '.modal-container' }
|
||||
);
|
||||
|
|
|
@ -499,6 +499,8 @@
|
|||
"change-card-parent": "Change card's parent",
|
||||
"parent-card": "Parent card",
|
||||
"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"
|
||||
|
||||
}
|
||||
|
|
|
@ -254,6 +254,10 @@ Boards.helpers({
|
|||
return _.findWhere(this.labels, { name, color });
|
||||
},
|
||||
|
||||
getLabelById(labelId){
|
||||
return _.findWhere(this.labels, { _id: labelId });
|
||||
},
|
||||
|
||||
labelIndex(labelId) {
|
||||
return _.pluck(this.labels, '_id').indexOf(labelId);
|
||||
},
|
||||
|
|
|
@ -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) {
|
||||
Activities.insert({
|
||||
userId,
|
||||
|
@ -680,6 +715,12 @@ if (Meteor.isServer) {
|
|||
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 also card_comments / checklists / attachments
|
||||
Cards.after.remove((userId, doc) => {
|
||||
|
|
|
@ -20,6 +20,9 @@ RulesHelper = {
|
|||
},
|
||||
findMatchingRules(activity){
|
||||
const activityType = activity.activityType;
|
||||
if(TriggersDef[activityType] == undefined){
|
||||
return [];
|
||||
}
|
||||
const matchingFields = TriggersDef[activityType].matchingFields;
|
||||
const matchingMap = this.buildMatchingFieldsMap(activity,matchingFields);
|
||||
let matchingTriggers = Triggers.find(matchingMap);
|
||||
|
|
|
@ -1,39 +1,29 @@
|
|||
TriggersDef = {
|
||||
createCard:{
|
||||
matchingFields: ["boardId","listId"]
|
||||
matchingFields: ["boardId", "listId"]
|
||||
},
|
||||
moveCard:{
|
||||
matchingFields: ["boardId","listId","oldListId"]
|
||||
matchingFields: ["boardId", "listId", "oldListId"]
|
||||
},
|
||||
archivedCard:{
|
||||
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"){
|
||||
|
||||
// }
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue