mirror of
https://github.com/wekan/wekan.git
synced 2025-12-24 03:10:12 +01:00
Fixed triggers to use names and not id
This commit is contained in:
parent
2f24dcfc7d
commit
3b62b5ec5d
7 changed files with 157 additions and 54 deletions
|
|
@ -11,7 +11,7 @@ BlazeComponent.extendComponent({
|
||||||
const actionSelected = this.find('#gen-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,"listName":"*"},function(error,id){
|
||||||
datas.triggerIdVar.set(id);
|
datas.triggerIdVar.set(id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -27,20 +27,13 @@ BlazeComponent.extendComponent({
|
||||||
const actionSelected = this.find('#create-action').value;
|
const actionSelected = this.find('#create-action').value;
|
||||||
const listName = this.find('#create-list-name').value;
|
const listName = this.find('#create-list-name').value;
|
||||||
const boardId = Session.get('currentBoard')
|
const boardId = Session.get('currentBoard')
|
||||||
const list = Lists.findOne({title:listName});
|
|
||||||
let listId;
|
|
||||||
if(list == undefined){
|
|
||||||
listId = "*"
|
|
||||||
}else{
|
|
||||||
listId = list._id;
|
|
||||||
}
|
|
||||||
if(actionSelected == "created"){
|
if(actionSelected == "created"){
|
||||||
Triggers.insert({activityType: "createCard","boardId":boardId,"listId":listId},function(error,id){
|
Triggers.insert({activityType: "createCard","boardId":boardId,"listName":listName},function(error,id){
|
||||||
datas.triggerIdVar.set(id);
|
datas.triggerIdVar.set(id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if(actionSelected == "removed"){
|
if(actionSelected == "removed"){
|
||||||
Triggers.insert({activityType: "removeCard","boardId":boardId,"listId":listId},function(error,id){
|
Triggers.insert({activityType: "removeCard","boardId":boardId,"listName":listName},function(error,id){
|
||||||
datas.triggerIdVar.set(id);
|
datas.triggerIdVar.set(id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -50,22 +43,13 @@ BlazeComponent.extendComponent({
|
||||||
const actionSelected = this.find('#move-action').value;
|
const actionSelected = this.find('#move-action').value;
|
||||||
const listName = this.find('#move-list-name').value;
|
const listName = this.find('#move-list-name').value;
|
||||||
const boardId = Session.get('currentBoard')
|
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"){
|
if(actionSelected == "moved-to"){
|
||||||
Triggers.insert({activityType: "moveCard","boardId":boardId,"listId":listId,"oldListId":"*"},function(error,id){
|
Triggers.insert({activityType: "moveCard","boardId":boardId,"listName":listName,"oldListName":"*"},function(error,id){
|
||||||
datas.triggerIdVar.set(id);
|
datas.triggerIdVar.set(id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if(actionSelected == "moved-from"){
|
if(actionSelected == "moved-from"){
|
||||||
Triggers.insert({activityType: "moveCard","boardId":boardId,"listId":"*","oldListId":listId},function(error,id){
|
Triggers.insert({activityType: "moveCard","boardId":boardId,"listName":"*","oldListName":listName},function(error,id){
|
||||||
datas.triggerIdVar.set(id);
|
datas.triggerIdVar.set(id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,12 @@ template(name="checklistTriggers")
|
||||||
div.trigger-text
|
div.trigger-text
|
||||||
| When a checklist is
|
| When a checklist is
|
||||||
div.trigger-dropdown
|
div.trigger-dropdown
|
||||||
select(id="create-action")
|
select(id="gen-check-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
|
||||||
| a card
|
| a card
|
||||||
div.trigger-button.js-add-gen.member-trigger.js-goto-action
|
div.trigger-button.js-add-gen-check-trigger.js-goto-action
|
||||||
i.fa.fa-plus
|
i.fa.fa-plus
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -18,16 +18,16 @@ template(name="checklistTriggers")
|
||||||
div.trigger-text
|
div.trigger-text
|
||||||
| When the checklist
|
| When the checklist
|
||||||
div.trigger-dropdown
|
div.trigger-dropdown
|
||||||
input(id="create-list-name",type=text,placeholder="Name")
|
input(id="check-name",type=text,placeholder="Name")
|
||||||
div.trigger-text
|
div.trigger-text
|
||||||
| is
|
| is
|
||||||
div.trigger-dropdown
|
div.trigger-dropdown
|
||||||
select(id="create-action")
|
select(id="spec-check-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
|
||||||
| a card
|
| a card
|
||||||
div.trigger-button.js-add-checklist-trigger.js-goto-action
|
div.trigger-button.js-add-spec-check-trigger.js-goto-action
|
||||||
i.fa.fa-plus
|
i.fa.fa-plus
|
||||||
|
|
||||||
div.trigger-item
|
div.trigger-item
|
||||||
|
|
@ -35,10 +35,10 @@ template(name="checklistTriggers")
|
||||||
div.trigger-text
|
div.trigger-text
|
||||||
| When a checklist is
|
| When a checklist is
|
||||||
div.trigger-dropdown
|
div.trigger-dropdown
|
||||||
select(id="create-action")
|
select(id="gen-comp-check-action")
|
||||||
option(value="created") Completed
|
option(value="completed") Completed
|
||||||
option(value="removed") Made incomplete
|
option(value="uncompleted") Made incomplete
|
||||||
div.trigger-button.js-add-gen.member-trigger.js-goto-action
|
div.trigger-button.js-add-gen-comp-trigger.js-goto-action
|
||||||
i.fa.fa-plus
|
i.fa.fa-plus
|
||||||
|
|
||||||
div.trigger-item
|
div.trigger-item
|
||||||
|
|
@ -46,14 +46,14 @@ template(name="checklistTriggers")
|
||||||
div.trigger-text
|
div.trigger-text
|
||||||
| When the checklist
|
| When the checklist
|
||||||
div.trigger-dropdown
|
div.trigger-dropdown
|
||||||
input(id="create-list-name",type=text,placeholder="Name")
|
input(id="spec-comp-check-name",type=text,placeholder="Name")
|
||||||
div.trigger-text
|
div.trigger-text
|
||||||
| is
|
| is
|
||||||
div.trigger-dropdown
|
div.trigger-dropdown
|
||||||
select(id="create-action")
|
select(id="spec-comp-check-action")
|
||||||
option(value="created") Completed
|
option(value="completed") Completed
|
||||||
option(value="removed") Made incomplete
|
option(value="uncompleted") Made incomplete
|
||||||
div.trigger-button.js-add-checklist-trigger.js-goto-action
|
div.trigger-button.js-add-spec-comp-trigger.js-goto-action
|
||||||
i.fa.fa-plus
|
i.fa.fa-plus
|
||||||
|
|
||||||
div.trigger-item
|
div.trigger-item
|
||||||
|
|
@ -61,10 +61,10 @@ template(name="checklistTriggers")
|
||||||
div.trigger-text
|
div.trigger-text
|
||||||
| When a checklist item is
|
| When a checklist item is
|
||||||
div.trigger-dropdown
|
div.trigger-dropdown
|
||||||
select(id="create-action")
|
select(id="check-item-gen-action")
|
||||||
option(value="created") Checked
|
option(value="checked") Checked
|
||||||
option(value="removed") Unchecked
|
option(value="unchecked") Unchecked
|
||||||
div.trigger-button.js-add-gen.member-trigger.js-goto-action
|
div.trigger-button.js-add-gen-check-item-trigger.js-goto-action
|
||||||
i.fa.fa-plus
|
i.fa.fa-plus
|
||||||
|
|
||||||
div.trigger-item
|
div.trigger-item
|
||||||
|
|
@ -72,12 +72,12 @@ template(name="checklistTriggers")
|
||||||
div.trigger-text
|
div.trigger-text
|
||||||
| When the checklist item
|
| When the checklist item
|
||||||
div.trigger-dropdown
|
div.trigger-dropdown
|
||||||
input(id="create-list-name",type=text,placeholder="Name")
|
input(id="check-item-name",type=text,placeholder="Name")
|
||||||
div.trigger-text
|
div.trigger-text
|
||||||
| is
|
| is
|
||||||
div.trigger-dropdown
|
div.trigger-dropdown
|
||||||
select(id="create-action")
|
select(id="check-item-spec-action")
|
||||||
option(value="created") Checked
|
option(value="checked") Checked
|
||||||
option(value="removed") Unchecked
|
option(value="unchecked") Unchecked
|
||||||
div.trigger-button.js-add-checklist-trigger.js-goto-action
|
div.trigger-button.js-add-spec-check-item-trigger.js-goto-action
|
||||||
i.fa.fa-plus
|
i.fa.fa-plus
|
||||||
108
client/components/rules/triggers/checklistTriggers.js
Normal file
108
client/components/rules/triggers/checklistTriggers.js
Normal file
|
|
@ -0,0 +1,108 @@
|
||||||
|
BlazeComponent.extendComponent({
|
||||||
|
onCreated() {
|
||||||
|
this.subscribe('allRules');
|
||||||
|
},
|
||||||
|
events() {
|
||||||
|
return [
|
||||||
|
{'click .js-add-gen-check-trigger'(event) {
|
||||||
|
|
||||||
|
let datas = this.data();
|
||||||
|
const actionSelected = this.find('#gen-check-action').value;
|
||||||
|
const boardId = Session.get('currentBoard')
|
||||||
|
if(actionSelected == "created"){
|
||||||
|
Triggers.insert({activityType: "addChecklist","boardId":boardId,"checklistName":"*"},function(error,id){
|
||||||
|
datas.triggerIdVar.set(id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if(actionSelected == "removed"){
|
||||||
|
Triggers.insert({activityType: "removeChecklist","boardId":boardId,"checklistName":"*"},function(error,id){
|
||||||
|
datas.triggerIdVar.set(id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'click .js-add-spec-check-trigger'(event) {
|
||||||
|
let datas = this.data();
|
||||||
|
const actionSelected = this.find('#spec-check-action').value;
|
||||||
|
const checklistId = this.find('#check-name').value;
|
||||||
|
const boardId = Session.get('currentBoard')
|
||||||
|
if(actionSelected == "created"){
|
||||||
|
Triggers.insert({activityType: "addChecklist","boardId":boardId,"checklistName":checklistId},function(error,id){
|
||||||
|
datas.triggerIdVar.set(id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if(actionSelected == "removed"){
|
||||||
|
Triggers.insert({activityType: "removeChecklist","boardId":boardId,"checklistName":checklistId},function(error,id){
|
||||||
|
datas.triggerIdVar.set(id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'click .js-add-gen-comp-trigger'(event) {
|
||||||
|
|
||||||
|
let datas = this.data();
|
||||||
|
const actionSelected = this.find('#gen-comp-check-action').value;
|
||||||
|
const boardId = Session.get('currentBoard')
|
||||||
|
if(actionSelected == "completed"){
|
||||||
|
Triggers.insert({activityType: "completeChecklist","boardId":boardId,"checklistName":"*"},function(error,id){
|
||||||
|
datas.triggerIdVar.set(id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if(actionSelected == "uncompleted"){
|
||||||
|
Triggers.insert({activityType: "uncompleteChecklist","boardId":boardId,"checklistName":"*"},function(error,id){
|
||||||
|
datas.triggerIdVar.set(id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'click .js-add-spec-comp-trigger'(event) {
|
||||||
|
let datas = this.data();
|
||||||
|
const actionSelected = this.find('#spec-comp-check-action').value;
|
||||||
|
const checklistId = this.find('#spec-comp-check-name').value;
|
||||||
|
const boardId = Session.get('currentBoard')
|
||||||
|
if(actionSelected == "added"){
|
||||||
|
Triggers.insert({activityType: "joinMember","boardId":boardId,"checklistName":checklistId},function(error,id){
|
||||||
|
datas.triggerIdVar.set(id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if(actionSelected == "removed"){
|
||||||
|
Triggers.insert({activityType: "unjoinMember","boardId":boardId,"checklistName":checklistId},function(error,id){
|
||||||
|
datas.triggerIdVar.set(id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'click .js-add-gen-check-item-trigger'(event) {
|
||||||
|
|
||||||
|
let datas = this.data();
|
||||||
|
const actionSelected = this.find('#check-item-gen-action').value;
|
||||||
|
const boardId = Session.get('currentBoard')
|
||||||
|
if(actionSelected == "checked"){
|
||||||
|
Triggers.insert({activityType: "checkedItem","boardId":boardId,"checklistItemName":"*"},function(error,id){
|
||||||
|
datas.triggerIdVar.set(id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if(actionSelected == "unchecked"){
|
||||||
|
Triggers.insert({activityType: "uncheckedItem","boardId":boardId,"checklistItemName":"*"},function(error,id){
|
||||||
|
datas.triggerIdVar.set(id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'click .js-add-spec-check-item-trigger'(event) {
|
||||||
|
let datas = this.data();
|
||||||
|
const actionSelected = this.find('#check-item-spec-action').value;
|
||||||
|
const checklistItemId = this.find('#check-item-name').value;
|
||||||
|
const boardId = Session.get('currentBoard')
|
||||||
|
if(actionSelected == "added"){
|
||||||
|
Triggers.insert({activityType: "joinMember","boardId":boardId,"checklistItemName":checklistItemId},function(error,id){
|
||||||
|
datas.triggerIdVar.set(id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if(actionSelected == "removed"){
|
||||||
|
Triggers.insert({activityType: "unjoinMember","boardId":boardId,"checklistItemName":checklistItemId},function(error,id){
|
||||||
|
datas.triggerIdVar.set(id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}];
|
||||||
|
},
|
||||||
|
|
||||||
|
}).register('checklistTriggers');
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -561,6 +561,7 @@ function cardMove(userId, doc, fieldNames, oldListId) {
|
||||||
userId,
|
userId,
|
||||||
oldListId,
|
oldListId,
|
||||||
activityType: 'moveCard',
|
activityType: 'moveCard',
|
||||||
|
listName: doc.title,
|
||||||
listId: doc.listId,
|
listId: doc.listId,
|
||||||
boardId: doc.boardId,
|
boardId: doc.boardId,
|
||||||
cardId: doc._id,
|
cardId: doc._id,
|
||||||
|
|
@ -574,6 +575,7 @@ function cardState(userId, doc, fieldNames) {
|
||||||
Activities.insert({
|
Activities.insert({
|
||||||
userId,
|
userId,
|
||||||
activityType: 'archivedCard',
|
activityType: 'archivedCard',
|
||||||
|
listName: doc.title,
|
||||||
boardId: doc.boardId,
|
boardId: doc.boardId,
|
||||||
listId: doc.listId,
|
listId: doc.listId,
|
||||||
cardId: doc._id,
|
cardId: doc._id,
|
||||||
|
|
@ -583,6 +585,7 @@ function cardState(userId, doc, fieldNames) {
|
||||||
userId,
|
userId,
|
||||||
activityType: 'restoredCard',
|
activityType: 'restoredCard',
|
||||||
boardId: doc.boardId,
|
boardId: doc.boardId,
|
||||||
|
listName: doc.title,
|
||||||
listId: doc.listId,
|
listId: doc.listId,
|
||||||
cardId: doc._id,
|
cardId: doc._id,
|
||||||
});
|
});
|
||||||
|
|
@ -664,6 +667,7 @@ function cardCreation(userId, doc) {
|
||||||
userId,
|
userId,
|
||||||
activityType: 'createCard',
|
activityType: 'createCard',
|
||||||
boardId: doc.boardId,
|
boardId: doc.boardId,
|
||||||
|
listName: doc.title,
|
||||||
listId: doc.listId,
|
listId: doc.listId,
|
||||||
cardId: doc._id,
|
cardId: doc._id,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,7 @@ function itemCreation(userId, doc) {
|
||||||
boardId,
|
boardId,
|
||||||
checklistId: doc.checklistId,
|
checklistId: doc.checklistId,
|
||||||
checklistItemId: doc._id,
|
checklistItemId: doc._id,
|
||||||
|
checklistItemName:doc.title
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -83,6 +84,7 @@ function itemRemover(userId, doc) {
|
||||||
boardId,
|
boardId,
|
||||||
checklistId: doc.checklistId,
|
checklistId: doc.checklistId,
|
||||||
checklistItemId: doc._id,
|
checklistItemId: doc._id,
|
||||||
|
checklistItemName:doc.title
|
||||||
});
|
});
|
||||||
Activities.remove({
|
Activities.remove({
|
||||||
checklistItemId: doc._id,
|
checklistItemId: doc._id,
|
||||||
|
|
@ -105,6 +107,7 @@ function publishCheckActivity(userId,doc){
|
||||||
boardId,
|
boardId,
|
||||||
checklistId: doc.checklistId,
|
checklistId: doc.checklistId,
|
||||||
checklistItemId: doc._id,
|
checklistItemId: doc._id,
|
||||||
|
checklistItemName:doc.title
|
||||||
}
|
}
|
||||||
console.log(act);
|
console.log(act);
|
||||||
Activities.insert(act);
|
Activities.insert(act);
|
||||||
|
|
@ -122,6 +125,7 @@ function publishChekListCompleted(userId,doc,fieldNames,modifier){
|
||||||
cardId: doc.cardId,
|
cardId: doc.cardId,
|
||||||
boardId,
|
boardId,
|
||||||
checklistId: doc.checklistId,
|
checklistId: doc.checklistId,
|
||||||
|
checklistName:doc.title
|
||||||
}
|
}
|
||||||
Activities.insert(act);
|
Activities.insert(act);
|
||||||
}
|
}
|
||||||
|
|
@ -139,6 +143,7 @@ function publishChekListUncompleted(userId,doc,fieldNames,modifier){
|
||||||
cardId: doc.cardId,
|
cardId: doc.cardId,
|
||||||
boardId,
|
boardId,
|
||||||
checklistId: doc.checklistId,
|
checklistId: doc.checklistId,
|
||||||
|
checklistName:doc.title
|
||||||
}
|
}
|
||||||
Activities.insert(act);
|
Activities.insert(act);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,7 @@ if (Meteor.isServer) {
|
||||||
cardId: doc.cardId,
|
cardId: doc.cardId,
|
||||||
boardId: Cards.findOne(doc.cardId).boardId,
|
boardId: Cards.findOne(doc.cardId).boardId,
|
||||||
checklistId: doc._id,
|
checklistId: doc._id,
|
||||||
|
checklistName:doc.title
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -107,6 +108,7 @@ if (Meteor.isServer) {
|
||||||
cardId: doc.cardId,
|
cardId: doc.cardId,
|
||||||
boardId: Cards.findOne(doc.cardId).boardId,
|
boardId: Cards.findOne(doc.cardId).boardId,
|
||||||
checklistId: doc._id,
|
checklistId: doc._id,
|
||||||
|
checklistName:doc.title
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
TriggersDef = {
|
TriggersDef = {
|
||||||
createCard:{
|
createCard:{
|
||||||
matchingFields: ["boardId", "listId"]
|
matchingFields: ["boardId", "listName"]
|
||||||
},
|
},
|
||||||
moveCard:{
|
moveCard:{
|
||||||
matchingFields: ["boardId", "listId", "oldListId"]
|
matchingFields: ["boardId", "listName", "oldListName"]
|
||||||
},
|
},
|
||||||
archivedCard:{
|
archivedCard:{
|
||||||
matchingFields: ["boardId"]
|
matchingFields: ["boardId"]
|
||||||
|
|
@ -18,28 +18,28 @@ TriggersDef = {
|
||||||
matchingFields: ["boardId","memberId"]
|
matchingFields: ["boardId","memberId"]
|
||||||
},
|
},
|
||||||
addChecklist:{
|
addChecklist:{
|
||||||
matchingFields: ["boardId","checklistId"]
|
matchingFields: ["boardId","checklistName"]
|
||||||
},
|
},
|
||||||
removeChecklist:{
|
removeChecklist:{
|
||||||
matchingFields: ["boardId","checklistId"]
|
matchingFields: ["boardId","checklistName"]
|
||||||
},
|
},
|
||||||
completeChecklist:{
|
completeChecklist:{
|
||||||
matchingFields: ["boardId","checklistId"]
|
matchingFields: ["boardId","checklistName"]
|
||||||
},
|
},
|
||||||
uncompleteChecklist:{
|
uncompleteChecklist:{
|
||||||
matchingFields: ["boardId","checklistId"]
|
matchingFields: ["boardId","checklistName"]
|
||||||
},
|
},
|
||||||
addedChecklistItem:{
|
addedChecklistItem:{
|
||||||
matchingFields: ["boardId","checklistItemId"]
|
matchingFields: ["boardId","checklistItemName"]
|
||||||
},
|
},
|
||||||
removedChecklistItem:{
|
removedChecklistItem:{
|
||||||
matchingFields: ["boardId","checklistItemId"]
|
matchingFields: ["boardId","checklistItemName"]
|
||||||
},
|
},
|
||||||
checkedItem:{
|
checkedItem:{
|
||||||
matchingFields: ["boardId","checklistItemId"]
|
matchingFields: ["boardId","checklistItemName"]
|
||||||
},
|
},
|
||||||
uncheckedItem:{
|
uncheckedItem:{
|
||||||
matchingFields: ["boardId","checklistItemId"]
|
matchingFields: ["boardId","checklistItemName"]
|
||||||
},
|
},
|
||||||
addAttachment:{
|
addAttachment:{
|
||||||
matchingFields: ["boardId"]
|
matchingFields: ["boardId"]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue