mirror of
https://github.com/wekan/wekan.git
synced 2026-01-24 18:26:10 +01:00
Replace mquandalle:collection-mutations with collection helpers
This commit is contained in:
parent
aca661583d
commit
94a3575e2c
35 changed files with 718 additions and 1321 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { ReactiveCache } from '/imports/reactiveCache';
|
||||
|
||||
Meteor.methods({
|
||||
watch(watchableType, id, level) {
|
||||
async watch(watchableType, id, level) {
|
||||
check(watchableType, String);
|
||||
check(id, String);
|
||||
check(level, Match.OneOf(String, null));
|
||||
|
|
@ -29,7 +29,7 @@ Meteor.methods({
|
|||
if (board.permission === 'private' && !board.hasMember(userId))
|
||||
throw new Meteor.Error('error-board-notAMember');
|
||||
|
||||
watchableObj.setWatcher(userId, level);
|
||||
await watchableObj.setWatcher(userId, level);
|
||||
return true;
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ Meteor.methods({
|
|||
return ret;
|
||||
},
|
||||
|
||||
moveSwimlane(swimlaneId, toBoardId) {
|
||||
async moveSwimlane(swimlaneId, toBoardId) {
|
||||
check(swimlaneId, String);
|
||||
check(toBoardId, String);
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ Meteor.methods({
|
|||
|
||||
let ret = false;
|
||||
if (swimlane && toBoard) {
|
||||
swimlane.move(toBoardId);
|
||||
await swimlane.move(toBoardId);
|
||||
|
||||
ret = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
import { ReactiveCache } from '/imports/reactiveCache';
|
||||
|
||||
RulesHelper = {
|
||||
executeRules(activity) {
|
||||
async executeRules(activity) {
|
||||
const matchingRules = this.findMatchingRules(activity);
|
||||
for (let i = 0; i < matchingRules.length; i++) {
|
||||
const action = matchingRules[i].getAction();
|
||||
if (action !== undefined) {
|
||||
this.performAction(activity, action);
|
||||
await this.performAction(activity, action);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -57,7 +57,7 @@ RulesHelper = {
|
|||
});
|
||||
return matchingMap;
|
||||
},
|
||||
performAction(activity, action) {
|
||||
async performAction(activity, action) {
|
||||
const card = ReactiveCache.getCard(activity.cardId);
|
||||
const boardId = activity.boardId;
|
||||
if (
|
||||
|
|
@ -112,12 +112,12 @@ RulesHelper = {
|
|||
const minOrder = _.min(
|
||||
list.cardsUnfiltered(swimlaneId).map(c => c.sort),
|
||||
);
|
||||
card.move(action.boardId, swimlaneId, listId, minOrder - 1);
|
||||
await card.move(action.boardId, swimlaneId, listId, minOrder - 1);
|
||||
} else {
|
||||
const maxOrder = _.max(
|
||||
list.cardsUnfiltered(swimlaneId).map(c => c.sort),
|
||||
);
|
||||
card.move(action.boardId, swimlaneId, listId, maxOrder + 1);
|
||||
await card.move(action.boardId, swimlaneId, listId, maxOrder + 1);
|
||||
}
|
||||
}
|
||||
if (action.actionType === 'sendEmail') {
|
||||
|
|
@ -247,13 +247,13 @@ RulesHelper = {
|
|||
}
|
||||
}
|
||||
if (action.actionType === 'archive') {
|
||||
card.archive();
|
||||
await card.archive();
|
||||
}
|
||||
if (action.actionType === 'unarchive') {
|
||||
card.restore();
|
||||
await card.restore();
|
||||
}
|
||||
if (action.actionType === 'setColor') {
|
||||
card.setColor(action.selectedColor);
|
||||
await card.setColor(action.selectedColor);
|
||||
}
|
||||
if (action.actionType === 'addLabel') {
|
||||
card.addLabel(action.labelId);
|
||||
|
|
@ -281,14 +281,14 @@ RulesHelper = {
|
|||
title: action.checklistName,
|
||||
cardId: card._id,
|
||||
});
|
||||
checkList.checkAllItems();
|
||||
await checkList.checkAllItems();
|
||||
}
|
||||
if (action.actionType === 'uncheckAll') {
|
||||
const checkList = ReactiveCache.getChecklist({
|
||||
title: action.checklistName,
|
||||
cardId: card._id,
|
||||
});
|
||||
checkList.uncheckAllItems();
|
||||
await checkList.uncheckAllItems();
|
||||
}
|
||||
if (action.actionType === 'checkItem') {
|
||||
const checkList = ReactiveCache.getChecklist({
|
||||
|
|
@ -299,7 +299,7 @@ RulesHelper = {
|
|||
title: action.checkItemName,
|
||||
checkListId: checkList._id,
|
||||
});
|
||||
checkItem.check();
|
||||
await checkItem.check();
|
||||
}
|
||||
if (action.actionType === 'uncheckItem') {
|
||||
const checkList = ReactiveCache.getChecklist({
|
||||
|
|
@ -310,7 +310,7 @@ RulesHelper = {
|
|||
title: action.checkItemName,
|
||||
checkListId: checkList._id,
|
||||
});
|
||||
checkItem.uncheck();
|
||||
await checkItem.uncheck();
|
||||
}
|
||||
if (action.actionType === 'addChecklist') {
|
||||
Checklists.insert({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue