mirror of
https://github.com/wekan/wekan.git
synced 2025-09-22 01:50:48 +02:00
Copy rules, triggers and actions when copying a board
This commit is contained in:
parent
0c3b92567e
commit
1c7a9e4de8
1 changed files with 23 additions and 0 deletions
|
@ -537,6 +537,29 @@ Boards.helpers({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// copy rules, actions, and triggers
|
||||||
|
const actionsMap = {};
|
||||||
|
Actions.find({ boardId: oldId }).forEach(action => {
|
||||||
|
const id = action._id;
|
||||||
|
delete action._id;
|
||||||
|
action.boardId = _id;
|
||||||
|
actionsMap[id] = Actions.insert(action);
|
||||||
|
});
|
||||||
|
const triggersMap = {};
|
||||||
|
Triggers.find({ boardId: oldId }).forEach(trigger => {
|
||||||
|
const id = trigger._id;
|
||||||
|
delete trigger._id;
|
||||||
|
trigger.boardId = _id;
|
||||||
|
triggersMap[id] = Triggers.insert(trigger);
|
||||||
|
});
|
||||||
|
Rules.find({ boardId: oldId }).forEach(rule => {
|
||||||
|
delete rule._id;
|
||||||
|
rule.boardId = _id;
|
||||||
|
rule.actionId = actionsMap[rule.actionId];
|
||||||
|
rule.triggerId = triggersMap[rule.triggerId];
|
||||||
|
Rules.insert(rule);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Is supplied user authorized to view this board?
|
* Is supplied user authorized to view this board?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue