diff options
-rw-r--r-- | i18n/en.i18n.json | 6 | ||||
-rw-r--r-- | models/activities.js | 1 | ||||
-rw-r--r-- | models/cardComments.js | 33 | ||||
-rw-r--r-- | models/checklistItems.js | 22 | ||||
-rw-r--r-- | models/checklists.js | 12 | ||||
-rw-r--r-- | models/customFields.js | 27 |
6 files changed, 82 insertions, 19 deletions
diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json index 9bd69b2a..912aac66 100644 --- a/i18n/en.i18n.json +++ b/i18n/en.i18n.json @@ -17,10 +17,14 @@ "act-completeChecklist": "completed checklist __checklist__ at card __card__ at list __list__ at swimlane __swimlane__ at board __board__", "act-uncompleteChecklist": "uncompleted checklist __checklist__ at card __card__ at list __list__ at swimlane __swimlane__ at board __board__", "act-addComment": "commented on card __card__: __comment__ at list __list__ at swimlane __swimlane__ at board __board__", + "act-editComment": "edited comment on card __card__: __comment__ at list __list__ at swimlane __swimlane__ at board __board__", + "act-deleteComment": "deleted comment on card __card__: __comment__ at list __list__ at swimlane __swimlane__ at board __board__", "act-createBoard": "created board __board__", "act-createSwimlane": "created swimlane __swimlane__ to board __board__", "act-createCard": "created card __card__ to list __list__ at swimlane __swimlane__ at board __board__", - "act-createCustomField": "created custom field __customField__ to card __card__ at list __list__ at swimlane __swimlane__ at board __board__", + "act-createCustomField": "created custom field __customField__ at board __board__", + "act-deleteCustomField": "deleted custom field __customField__ at board __board__", + "act-setCustomField": "set custom field __customField__: __customFieldValue__ at card __card__ at list __list__ at swimlane __swimlane__ at board __board__", "act-createList": "added list __list__ to board __board__", "act-addBoardMember": "added member __member__ to board __board__", "act-archivedBoard": "Board __board__ moved to Archive", diff --git a/models/activities.js b/models/activities.js index a4a48284..908d4b14 100644 --- a/models/activities.js +++ b/models/activities.js @@ -180,6 +180,7 @@ if (Meteor.isServer) { if (activity.customFieldId) { const customField = activity.customField(); params.customField = customField.name; + params.customFieldValue = customField.text; } // Label activity did not work yet, unable to edit labels when tried this. //if (activity.labelId) { diff --git a/models/cardComments.js b/models/cardComments.js index 2bcb5453..a823066c 100644 --- a/models/cardComments.js +++ b/models/cardComments.js @@ -81,14 +81,15 @@ CardComments.helpers({ CardComments.hookOptions.after.update = { fetchPrevious: false }; function commentCreation(userId, doc){ + const card = Cards.findOne(doc.cardId); Activities.insert({ userId, activityType: 'addComment', boardId: doc.boardId, cardId: doc.cardId, commentId: doc._id, - listId: doc.listId, - swimlaneId: doc.swimlaneId, + listId: card.listId, + swimlaneId: card.swimlaneId, }); } @@ -103,6 +104,34 @@ if (Meteor.isServer) { commentCreation(userId, doc); }); + CardComments.after.update((userId, doc) => { + const activity = Activities.findOne({ commentId: doc._id }); + const card = Cards.findOne(doc.cardId); + Activities.insert({ + userId, + activityType: 'editComment', + boardId: doc.boardId, + cardId: doc.cardId, + commentId: doc._id, + listId: card.listId, + swimlaneId: card.swimlaneId, + }); + }); + + CardComments.before.remove((userId, doc) => { + const activity = Activities.findOne({ commentId: doc._id }); + const card = Cards.findOne(doc.cardId); + Activities.insert({ + userId, + activityType: 'deleteComment', + boardId: doc.boardId, + cardId: doc.cardId, + commentId: doc._id, + listId: card.listId, + swimlaneId: card.swimlaneId, + }); + }); + CardComments.after.remove((userId, doc) => { const activity = Activities.findOne({ commentId: doc._id }); if (activity) { diff --git a/models/checklistItems.js b/models/checklistItems.js index 013fee04..df56c475 100644 --- a/models/checklistItems.js +++ b/models/checklistItems.js @@ -94,9 +94,9 @@ function itemCreation(userId, doc) { boardId, checklistId: doc.checklistId, checklistItemId: doc._id, - checklistItemName:doc.title, - listId: doc.listId, - swimlaneId: doc.swimlaneId, + checklistItemName: doc.title, + listId: card.listId, + swimlaneId: card.swimlaneId, }); } @@ -123,8 +123,8 @@ function publishCheckActivity(userId, doc){ checklistId: doc.checklistId, checklistItemId: doc._id, checklistItemName:doc.title, - listId: doc.listId, - swimlaneId: doc.swimlaneId, + listId: card.listId, + swimlaneId: card.swimlaneId, }; Activities.insert(act); } @@ -142,8 +142,8 @@ function publishChekListCompleted(userId, doc){ boardId, checklistId: doc.checklistId, checklistName: checkList.title, - listId: doc.listId, - swimlaneId: doc.swimlaneId, + listId: card.listId, + swimlaneId: card.swimlaneId, }; Activities.insert(act); } @@ -175,8 +175,8 @@ function publishChekListUncompleted(userId, doc){ boardId, checklistId: doc.checklistId, checklistName: checkList.title, - listId: doc.listId, - swimlaneId: doc.swimlaneId, + listId: card.listId, + swimlaneId: card.swimlaneId, }; Activities.insert(act); } @@ -215,8 +215,8 @@ if (Meteor.isServer) { checklistId: doc.checklistId, checklistItemId: doc._id, checklistItemName:doc.title, - listId: doc.listId, - swimlaneId: doc.swimlaneId, + listId: card.listId, + swimlaneId: card.swimlaneId, }); }); } diff --git a/models/checklists.js b/models/checklists.js index 33cb0f40..653fed4d 100644 --- a/models/checklists.js +++ b/models/checklists.js @@ -128,20 +128,22 @@ if (Meteor.isServer) { }); Checklists.after.insert((userId, doc) => { + const card = Cards.findOne(doc.cardId); Activities.insert({ userId, activityType: 'addChecklist', cardId: doc.cardId, - boardId: Cards.findOne(doc.cardId).boardId, + boardId: card.boardId, checklistId: doc._id, checklistName:doc.title, - listId: doc.listId, - swimlaneId: doc.swimlaneId, + listId: card.listId, + swimlaneId: card.swimlaneId, }); }); Checklists.before.remove((userId, doc) => { const activities = Activities.find({ checklistId: doc._id }); + const card = Cards.findOne(doc.cardId); if (activities) { activities.forEach((activity) => { Activities.remove(activity._id); @@ -154,8 +156,8 @@ if (Meteor.isServer) { boardId: Cards.findOne(doc.cardId).boardId, checklistId: doc._id, checklistName:doc.title, - listId: doc.listId, - swimlaneId: doc.swimlaneId, + listId: card.listId, + swimlaneId: card.swimlaneId, }); }); } diff --git a/models/customFields.js b/models/customFields.js index a67ddb7d..83033cb4 100644 --- a/models/customFields.js +++ b/models/customFields.js @@ -117,6 +117,29 @@ function customFieldCreation(userId, doc){ }); } +function customFieldDeletion(userId, doc){ + Activities.insert({ + userId, + activityType: 'deleteCustomField', + boardId: doc.boardIds[0], // We are creating a customField, it has only one boardId + customFieldId: doc._id, + }); +} + +// This has some bug, it does not show edited customField value at Outgoing Webhook, +// instead it shows undefined, and no listId and swimlaneId. +function customFieldEdit(userId, doc){ + const card = Cards.findOne(doc.cardId); + Activities.insert({ + userId, + activityType: 'editCustomField', + boardId: doc.boardIds[0], // We are creating a customField, it has only one boardId + customFieldId: doc._id, + listId: card.listId, + swimlaneId: card.swimlaneId, + }); +} + if (Meteor.isServer) { Meteor.startup(() => { CustomFields._collection._ensureIndex({ boardIds: 1 }); @@ -133,9 +156,12 @@ if (Meteor.isServer) { {$pull: {'customFields': {'_id': doc._id}}}, {multi: true} ); + customFieldEdit(userId, doc); Activities.remove({ customFieldId: doc._id, boardId: modifier.$pull.boardIds, + listId: card.listId, + swimlaneId: card.swimlaneId, }); } else if (_.contains(fieldNames, 'boardIds') && modifier.$push) { Activities.insert({ @@ -148,6 +174,7 @@ if (Meteor.isServer) { }); CustomFields.before.remove((userId, doc) => { + customFieldDeletion(userId, doc); Activities.remove({ customFieldId: doc._id, }); |