Browse Source

Show attachment name in Outgoing Webhook when attachment is removed from card.

Thanks to xet7 !

Related #2285
Lauri Ojansivu 6 years ago
parent
commit
23ccb3b991
1 changed files with 8 additions and 4 deletions
  1. 8 4
      models/attachments.js

+ 8 - 4
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,
+    });
+  });
 }