Browse Source

Merge branch 'auto-update-card-cover-with-latest-uploaded-image' of https://github.com/thuanpq/wekan into thuanpq-auto-update-card-cover-with-latest-uploaded-image

Lauri Ojansivu 7 years ago
parent
commit
07954c0f6d
1 changed files with 7 additions and 1 deletions
  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();
     });
     });
   },
   },