mirror of
https://github.com/wekan/wekan.git
synced 2025-04-22 04:57:07 -04: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 boardId = Session.get('currentBoard')
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
@ -27,20 +27,13 @@ BlazeComponent.extendComponent({
|
|||
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){
|
||||
Triggers.insert({activityType: "createCard","boardId":boardId,"listName":listName},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
@ -50,22 +43,13 @@ BlazeComponent.extendComponent({
|
|||
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){
|
||||
Triggers.insert({activityType: "moveCard","boardId":boardId,"listName":listName,"oldListName":"*"},function(error,id){
|
||||
datas.triggerIdVar.set(id);
|
||||
});
|
||||
}
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -4,12 +4,12 @@ template(name="checklistTriggers")
|
|||
div.trigger-text
|
||||
| When a checklist is
|
||||
div.trigger-dropdown
|
||||
select(id="create-action")
|
||||
select(id="gen-check-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
|
||||
div.trigger-button.js-add-gen-check-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
||||
|
||||
|
||||
|
@ -18,16 +18,16 @@ template(name="checklistTriggers")
|
|||
div.trigger-text
|
||||
| When the checklist
|
||||
div.trigger-dropdown
|
||||
input(id="create-list-name",type=text,placeholder="Name")
|
||||
input(id="check-name",type=text,placeholder="Name")
|
||||
div.trigger-text
|
||||
| is
|
||||
div.trigger-dropdown
|
||||
select(id="create-action")
|
||||
select(id="spec-check-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
|
||||
div.trigger-button.js-add-spec-check-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
||||
|
||||
div.trigger-item
|
||||
|
@ -35,10 +35,10 @@ template(name="checklistTriggers")
|
|||
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
|
||||
select(id="gen-comp-check-action")
|
||||
option(value="completed") Completed
|
||||
option(value="uncompleted") Made incomplete
|
||||
div.trigger-button.js-add-gen-comp-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
||||
|
||||
div.trigger-item
|
||||
|
@ -46,14 +46,14 @@ template(name="checklistTriggers")
|
|||
div.trigger-text
|
||||
| When the checklist
|
||||
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
|
||||
| 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
|
||||
select(id="spec-comp-check-action")
|
||||
option(value="completed") Completed
|
||||
option(value="uncompleted") Made incomplete
|
||||
div.trigger-button.js-add-spec-comp-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
||||
|
||||
div.trigger-item
|
||||
|
@ -61,10 +61,10 @@ template(name="checklistTriggers")
|
|||
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
|
||||
select(id="check-item-gen-action")
|
||||
option(value="checked") Checked
|
||||
option(value="unchecked") Unchecked
|
||||
div.trigger-button.js-add-gen-check-item-trigger.js-goto-action
|
||||
i.fa.fa-plus
|
||||
|
||||
div.trigger-item
|
||||
|
@ -72,12 +72,12 @@ template(name="checklistTriggers")
|
|||
div.trigger-text
|
||||
| When the checklist item
|
||||
div.trigger-dropdown
|
||||
input(id="create-list-name",type=text,placeholder="Name")
|
||||
input(id="check-item-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
|
||||
select(id="check-item-spec-action")
|
||||
option(value="checked") Checked
|
||||
option(value="unchecked") Unchecked
|
||||
div.trigger-button.js-add-spec-check-item-trigger.js-goto-action
|
||||
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,
|
||||
oldListId,
|
||||
activityType: 'moveCard',
|
||||
listName: doc.title,
|
||||
listId: doc.listId,
|
||||
boardId: doc.boardId,
|
||||
cardId: doc._id,
|
||||
|
@ -574,6 +575,7 @@ function cardState(userId, doc, fieldNames) {
|
|||
Activities.insert({
|
||||
userId,
|
||||
activityType: 'archivedCard',
|
||||
listName: doc.title,
|
||||
boardId: doc.boardId,
|
||||
listId: doc.listId,
|
||||
cardId: doc._id,
|
||||
|
@ -583,6 +585,7 @@ function cardState(userId, doc, fieldNames) {
|
|||
userId,
|
||||
activityType: 'restoredCard',
|
||||
boardId: doc.boardId,
|
||||
listName: doc.title,
|
||||
listId: doc.listId,
|
||||
cardId: doc._id,
|
||||
});
|
||||
|
@ -664,6 +667,7 @@ function cardCreation(userId, doc) {
|
|||
userId,
|
||||
activityType: 'createCard',
|
||||
boardId: doc.boardId,
|
||||
listName: doc.title,
|
||||
listId: doc.listId,
|
||||
cardId: doc._id,
|
||||
});
|
||||
|
|
|
@ -70,6 +70,7 @@ function itemCreation(userId, doc) {
|
|||
boardId,
|
||||
checklistId: doc.checklistId,
|
||||
checklistItemId: doc._id,
|
||||
checklistItemName:doc.title
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -83,6 +84,7 @@ function itemRemover(userId, doc) {
|
|||
boardId,
|
||||
checklistId: doc.checklistId,
|
||||
checklistItemId: doc._id,
|
||||
checklistItemName:doc.title
|
||||
});
|
||||
Activities.remove({
|
||||
checklistItemId: doc._id,
|
||||
|
@ -105,6 +107,7 @@ function publishCheckActivity(userId,doc){
|
|||
boardId,
|
||||
checklistId: doc.checklistId,
|
||||
checklistItemId: doc._id,
|
||||
checklistItemName:doc.title
|
||||
}
|
||||
console.log(act);
|
||||
Activities.insert(act);
|
||||
|
@ -122,6 +125,7 @@ function publishChekListCompleted(userId,doc,fieldNames,modifier){
|
|||
cardId: doc.cardId,
|
||||
boardId,
|
||||
checklistId: doc.checklistId,
|
||||
checklistName:doc.title
|
||||
}
|
||||
Activities.insert(act);
|
||||
}
|
||||
|
@ -139,6 +143,7 @@ function publishChekListUncompleted(userId,doc,fieldNames,modifier){
|
|||
cardId: doc.cardId,
|
||||
boardId,
|
||||
checklistId: doc.checklistId,
|
||||
checklistName:doc.title
|
||||
}
|
||||
Activities.insert(act);
|
||||
}
|
||||
|
|
|
@ -91,6 +91,7 @@ if (Meteor.isServer) {
|
|||
cardId: doc.cardId,
|
||||
boardId: Cards.findOne(doc.cardId).boardId,
|
||||
checklistId: doc._id,
|
||||
checklistName:doc.title
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -107,6 +108,7 @@ if (Meteor.isServer) {
|
|||
cardId: doc.cardId,
|
||||
boardId: Cards.findOne(doc.cardId).boardId,
|
||||
checklistId: doc._id,
|
||||
checklistName:doc.title
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
TriggersDef = {
|
||||
createCard:{
|
||||
matchingFields: ["boardId", "listId"]
|
||||
matchingFields: ["boardId", "listName"]
|
||||
},
|
||||
moveCard:{
|
||||
matchingFields: ["boardId", "listId", "oldListId"]
|
||||
matchingFields: ["boardId", "listName", "oldListName"]
|
||||
},
|
||||
archivedCard:{
|
||||
matchingFields: ["boardId"]
|
||||
|
@ -18,28 +18,28 @@ TriggersDef = {
|
|||
matchingFields: ["boardId","memberId"]
|
||||
},
|
||||
addChecklist:{
|
||||
matchingFields: ["boardId","checklistId"]
|
||||
matchingFields: ["boardId","checklistName"]
|
||||
},
|
||||
removeChecklist:{
|
||||
matchingFields: ["boardId","checklistId"]
|
||||
matchingFields: ["boardId","checklistName"]
|
||||
},
|
||||
completeChecklist:{
|
||||
matchingFields: ["boardId","checklistId"]
|
||||
matchingFields: ["boardId","checklistName"]
|
||||
},
|
||||
uncompleteChecklist:{
|
||||
matchingFields: ["boardId","checklistId"]
|
||||
matchingFields: ["boardId","checklistName"]
|
||||
},
|
||||
addedChecklistItem:{
|
||||
matchingFields: ["boardId","checklistItemId"]
|
||||
matchingFields: ["boardId","checklistItemName"]
|
||||
},
|
||||
removedChecklistItem:{
|
||||
matchingFields: ["boardId","checklistItemId"]
|
||||
matchingFields: ["boardId","checklistItemName"]
|
||||
},
|
||||
checkedItem:{
|
||||
matchingFields: ["boardId","checklistItemId"]
|
||||
matchingFields: ["boardId","checklistItemName"]
|
||||
},
|
||||
uncheckedItem:{
|
||||
matchingFields: ["boardId","checklistItemId"]
|
||||
matchingFields: ["boardId","checklistItemName"]
|
||||
},
|
||||
addAttachment:{
|
||||
matchingFields: ["boardId"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue