summaryrefslogtreecommitdiffstats
path: root/models/cardComments.js
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2019-06-27 05:04:23 +0300
committerLauri Ojansivu <x@xet7.org>2019-06-27 05:04:23 +0300
commitfb728baf0c87bae5fa39d92089b667ff1ed69fa6 (patch)
treeddc4a0732aff7c6ebe308dbd1095196beba0acca /models/cardComments.js
parent0c352ab14385a886e06b03917b4443a18c8a12a1 (diff)
parent436db99a5bdbab1215c425fab4d298b2783948c8 (diff)
downloadwekan-fb728baf0c87bae5fa39d92089b667ff1ed69fa6.tar.gz
wekan-fb728baf0c87bae5fa39d92089b667ff1ed69fa6.tar.bz2
wekan-fb728baf0c87bae5fa39d92089b667ff1ed69fa6.zip
Merge branch 'edge' into meteor-1.8
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) {