From 23ccb3b991be6d7196e59f7d68df17b8949df049 Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Tue, 11 Jun 2019 13:11:35 +0300 Subject: [PATCH] Show attachment name in Outgoing Webhook when attachment is removed from card. Thanks to xet7 ! Related #2285 --- models/attachments.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/models/attachments.js b/models/attachments.js index fb32f497b..71b30eee4 100644 --- a/models/attachments.js +++ b/models/attachments.js @@ -88,18 +88,22 @@ if (Meteor.isServer) { } }); - Attachments.files.after.remove((userId, doc) => { - Activities.remove({ - attachmentId: doc._id, - }); + Attachments.files.before.remove((userId, doc) => { Activities.insert({ userId, type: 'card', activityType: 'deleteAttachment', + attachmentId: doc._id, boardId: doc.boardId, cardId: doc.cardId, listId: doc.listId, swimlaneId: doc.swimlaneId, }); }); + + Attachments.files.after.remove((userId, doc) => { + Activities.remove({ + attachmentId: doc._id, + }); + }); }