Browse Source

Merge branch 'thuanpq-auto-update-card-cover-with-latest-uploaded-image' into devel

Lauri Ojansivu 7 years ago
parent
commit
7214e4bb2f
2 changed files with 8 additions and 1 deletions
  1. 1 0
      CHANGELOG.md
  2. 7 1
      client/components/cards/attachments.js

+ 1 - 0
CHANGELOG.md

@@ -4,6 +4,7 @@ This release adds the following new features:
 
 * [Change password of any user in Standalone Wekan Admin Panel](https://github.com/wekan/wekan/pull/1372);
 * [Performance optimization: Move more global subscriptions to template subscription](https://github.com/wekan/wekan/pull/1373);
+* [Auto update card cover with latest uploaded image attachment](https://github.com/wekan/wekan/pull/1387).
 * Update tranlations. Add Latvian language;
 * Update to Meteor 1.6.0, Node 6.12.2 and MongoDB 3.2.18.
 

+ 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();
     });
   },