ソースを参照

Remove attachment activity

Angelo Gallarello 6 年 前
コミット
f7446ba934

+ 5 - 0
client/components/activities/activities.jade

@@ -14,6 +14,9 @@ template(name="boardActivities")
       p.activity-desc
       p.activity-desc
         +memberName(user=user)
         +memberName(user=user)
 
 
+        if($eq activityType 'deleteAttachment')
+          | {{{_ 'activity-delete-attach' cardLink}}}.
+
         if($eq activityType 'addAttachment')
         if($eq activityType 'addAttachment')
           | {{{_ 'activity-attached' attachmentLink cardLink}}}.
           | {{{_ 'activity-attached' attachmentLink cardLink}}}.
 
 
@@ -134,6 +137,8 @@ template(name="cardActivities")
           | {{{_ 'activity-attached' attachmentLink cardLabel}}}.
           | {{{_ 'activity-attached' attachmentLink cardLabel}}}.
           if attachment.isImage
           if attachment.isImage
             img.attachment-image-preview(src=attachment.url)
             img.attachment-image-preview(src=attachment.url)
+        if($eq activityType 'deleteAttachment')
+          | {{{_ 'activity-attached' attachmentLink cardLabel}}}.
         if($eq activityType 'addChecklist')
         if($eq activityType 'addChecklist')
           | {{{_ 'activity-checklist-added' cardLabel}}}.
           | {{{_ 'activity-checklist-added' cardLabel}}}.
           .activity-checklist
           .activity-checklist

+ 2 - 1
i18n/en.i18n.json

@@ -501,6 +501,7 @@
     "source-board": "Source board",
     "source-board": "Source board",
     "no-parent": "Don't show parent",
     "no-parent": "Don't show parent",
     "activity-added-label": "added label '%s' to %s",
     "activity-added-label": "added label '%s' to %s",
-    "activity-removed-label": "removed label '%s' from %s"
+    "activity-removed-label": "removed label '%s' from %s",
+    "activity-delete-attach": "deleted an attachment from %s"
 
 
 }
 }

+ 7 - 0
models/attachments.js

@@ -86,5 +86,12 @@ if (Meteor.isServer) {
     Activities.remove({
     Activities.remove({
       attachmentId: doc._id,
       attachmentId: doc._id,
     });
     });
+    Activities.insert({
+        userId,
+        type: 'card',
+        activityType: 'deleteAttachment',
+        boardId: doc.boardId,
+        cardId: doc.cardId,
+      });
   });
   });
 }
 }

+ 8 - 0
server/triggersDef.js

@@ -22,7 +22,15 @@ TriggersDef = {
 	},
 	},
 	addChecklistItem:{
 	addChecklistItem:{
 		matchingFields: ["boardId","checklistItemId"]
 		matchingFields: ["boardId","checklistItemId"]
+	},
+	addAttachment:{
+		matchingFields: ["boardId","checklistId"]
+	},
+	deleteAttachment:{
+		matchingFields: ["boardId","checklistItemId"]
 	}
 	}
+
+
 }
 }