Browse Source

Multi-File Storage code was missing after merge

- Merge commit was: 68e815580552e2bcdba46f5d6b47bb91332033c0
- Partially resolved by this commit: a34cbf95e84bb46fb4da673fe50333341cc781b1
Martin Filser 3 years ago
parent
commit
3fad014e91
3 changed files with 16 additions and 3 deletions
  1. 2 2
      client/components/cards/attachments.jade
  2. 6 1
      models/attachments.js
  3. 8 0
      models/avatars.js

+ 2 - 2
client/components/cards/attachments.jade

@@ -20,7 +20,7 @@ template(name="attachmentsGalery")
     each attachments
     each attachments
       .attachment-item
       .attachment-item
         a.attachment-thumbnail.swipebox(href="{{link}}" title="{{name}}")
         a.attachment-thumbnail.swipebox(href="{{link}}" title="{{name}}")
-          if isUploaded
+          if link
             if isImage
             if isImage
               img.attachment-thumbnail-img(src="{{link}}")
               img.attachment-thumbnail-img(src="{{link}}")
             else if($eq extension 'mp3')
             else if($eq extension 'mp3')
@@ -38,7 +38,7 @@ template(name="attachmentsGalery")
             else
             else
               span.attachment-thumbnail-ext= extension
               span.attachment-thumbnail-ext= extension
           else
           else
-            span.attachment-thumbnail-ext= extension
+            +spinner
         p.attachment-details
         p.attachment-details
           = name
           = name
           span.file-size ({{fileSize size}} KB)
           span.file-size ({{fileSize size}} KB)

+ 6 - 1
models/attachments.js

@@ -89,7 +89,12 @@ if (Meteor.isServer) {
   });
   });
 
 
   Meteor.startup(() => {
   Meteor.startup(() => {
-    Attachments.collection.createIndex({ cardId: 1 });
+    Attachments.collection.createIndex({ 'meta.cardId': 1 });
+    const storagePath = fileStoreStrategyFactory.storagePath;
+    if (!fs.existsSync(storagePath)) {
+      console.log("create storagePath because it doesn't exist: " + storagePath);
+      fs.mkdirSync(storagePath, { recursive: true });
+    }
   });
   });
 }
 }
 
 

+ 8 - 0
models/avatars.js

@@ -59,6 +59,14 @@ if (Meteor.isServer) {
     remove: isOwner,
     remove: isOwner,
     fetch: ['userId'],
     fetch: ['userId'],
   });
   });
+
+  Meteor.startup(() => {
+    const storagePath = fileStoreStrategyFactory.storagePath;
+    if (!fs.existsSync(storagePath)) {
+      console.log("create storagePath because it doesn't exist: " + storagePath);
+      fs.mkdirSync(storagePath, { recursive: true });
+    }
+  });
 }
 }
 
 
 export default Avatars;
 export default Avatars;