mirror of
https://github.com/wekan/wekan.git
synced 2026-01-31 05:35:16 +01:00
Add checklist items to activity log
This commit is contained in:
parent
01928bfe5a
commit
2b9bc5d046
4 changed files with 28 additions and 10 deletions
|
|
@ -38,6 +38,9 @@ Activities.helpers({
|
|||
checklist() {
|
||||
return Checklists.findOne(this.checklistId);
|
||||
},
|
||||
checklistItem() {
|
||||
return Checklists.findOne(this.checklistId).getItem(this.checklistItemId);
|
||||
},
|
||||
});
|
||||
|
||||
Activities.before.insert((userId, doc) => {
|
||||
|
|
|
|||
|
|
@ -161,16 +161,19 @@ if (Meteor.isServer) {
|
|||
});
|
||||
|
||||
//TODO: so there will be no activity for adding item into checklist, maybe will be implemented in the future.
|
||||
// Checklists.after.update((userId, doc) => {
|
||||
// console.log('update:', doc)
|
||||
// Activities.insert({
|
||||
// userId,
|
||||
// activityType: 'addChecklist',
|
||||
// boardId: doc.boardId,
|
||||
// cardId: doc.cardId,
|
||||
// checklistId: doc._id,
|
||||
// });
|
||||
// });
|
||||
// The future is now
|
||||
Checklists.after.update((userId, doc, fieldNames, modifier) => {
|
||||
if (fieldNames.includes('items')) {
|
||||
Activities.insert({
|
||||
userId,
|
||||
activityType: 'addChecklistItem',
|
||||
cardId: doc.cardId,
|
||||
boardId: Cards.findOne(doc.cardId).boardId,
|
||||
checklistId: doc._id,
|
||||
checklistItemId: modifier.$addToSet.items._id,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Checklists.before.remove((userId, doc) => {
|
||||
const activity = Activities.findOne({ checklistId: doc._id });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue