summaryrefslogtreecommitdiffstats
path: root/models/cardComments.js
diff options
context:
space:
mode:
Diffstat (limited to 'models/cardComments.js')
-rw-r--r--models/cardComments.js33
1 files changed, 31 insertions, 2 deletions
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) {