瀏覽代碼

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 年之前
父節點
當前提交
07954c0f6d
共有 1 個文件被更改,包括 7 次插入1 次删除
  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.cardId = card._id;
       file.userId = Meteor.userId();
-      Attachments.insert(file);
+
+      const attachment = Attachments.insert(file);
+
+      if (attachment && attachment._id && attachment.isImage()) {
+        card.setCover(attachment._id);
+      }
+
       Popup.close();
     });
   },