Quellcode durchsuchen

Added - auto update card cover with latest uploaded image attachment of card

Thuan Pham Quoc vor 7 Jahren
Ursprung
Commit
84d60b5908
1 geänderte Dateien mit 7 neuen und 1 gelöschten Zeilen
  1. 7 1
      client/components/cards/attachments.js

+ 7 - 1
client/components/cards/attachments.js

@@ -60,7 +60,13 @@ Template.cardAttachmentsPopup.events({
       file.boardId = card.boardId;
       file.boardId = card.boardId;
       file.cardId = card._id;
       file.cardId = card._id;
       file.userId = Meteor.userId();
       file.userId = Meteor.userId();
-      Attachments.insert(file);
+
+      const attachment = Attachments.insert(file);
+
+      if (attachment && attachment._id && attachment.isImage()) {
+        card.setCover(attachment._id);
+      }
+
       Popup.close();
       Popup.close();
     });
     });
   },
   },