|
@@ -8,8 +8,7 @@ Attachments = new FilesCollection({
|
|
allowClientCode: true,
|
|
allowClientCode: true,
|
|
collectionName: 'attachments2',
|
|
collectionName: 'attachments2',
|
|
onAfterUpload: onAttachmentUploaded,
|
|
onAfterUpload: onAttachmentUploaded,
|
|
- onBeforeRemove: onAttachmentRemoving,
|
|
|
|
- onAfterRemove: onAttachmentRemoved
|
|
|
|
|
|
+ onBeforeRemove: onAttachmentRemoving
|
|
});
|
|
});
|
|
|
|
|
|
if (Meteor.isServer) {
|
|
if (Meteor.isServer) {
|
|
@@ -41,9 +40,9 @@ function onAttachmentUploaded(fileRef) {
|
|
type: 'card',
|
|
type: 'card',
|
|
activityType: 'addAttachment',
|
|
activityType: 'addAttachment',
|
|
attachmentId: fileRef._id,
|
|
attachmentId: fileRef._id,
|
|
- // this preserves the name so that notifications can be meaningful after
|
|
|
|
|
|
+ // this preserves the name so that notifications can be meaningful after
|
|
// this file is removed
|
|
// this file is removed
|
|
- attachmentName: fileRef.versions.original.name,
|
|
|
|
|
|
+ attachmentName: fileRef.name,
|
|
boardId: fileRef.meta.boardId,
|
|
boardId: fileRef.meta.boardId,
|
|
cardId: fileRef.meta.cardId,
|
|
cardId: fileRef.meta.cardId,
|
|
listId: fileRef.meta.listId,
|
|
listId: fileRef.meta.listId,
|
|
@@ -73,9 +72,9 @@ function onAttachmentRemoving(cursor) {
|
|
type: 'card',
|
|
type: 'card',
|
|
activityType: 'deleteAttachment',
|
|
activityType: 'deleteAttachment',
|
|
attachmentId: file._id,
|
|
attachmentId: file._id,
|
|
- // this preserves the name so that notifications can be meaningful after
|
|
|
|
|
|
+ // this preserves the name so that notifications can be meaningful after
|
|
// this file is removed
|
|
// this file is removed
|
|
- attachmentName: file.versions.original.name,
|
|
|
|
|
|
+ attachmentName: file.name,
|
|
boardId: meta.boardId,
|
|
boardId: meta.boardId,
|
|
cardId: meta.cardId,
|
|
cardId: meta.cardId,
|
|
listId: meta.listId,
|
|
listId: meta.listId,
|
|
@@ -84,14 +83,4 @@ function onAttachmentRemoving(cursor) {
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
-function onAttachmentRemoved(files) {
|
|
|
|
- // Don't know why we need to remove the activity
|
|
|
|
-/* for (let i in files) {
|
|
|
|
- let doc = files[i];
|
|
|
|
- Activities.remove({
|
|
|
|
- attachmentId: doc._id,
|
|
|
|
- });
|
|
|
|
- }*/
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
export default Attachments;
|
|
export default Attachments;
|