Explorar o código

Attachment selection, simpler code logic

Martin Filser %!s(int64=3) %!d(string=hai) anos
pai
achega
b6374dac3d
Modificáronse 1 ficheiros con 7 adicións e 9 borrados
  1. 7 9
      models/cards.js

+ 7 - 9
models/cards.js

@@ -739,17 +739,15 @@ Cards.helpers({
   },
 
   attachments() {
+    let id = this._id;
     if (this.isLinkedCard()) {
-      return Attachments.find(
-        { 'meta.cardId': this.linkedId },
-        { sort: { uploadedAt: -1 } },
-      ).each();
-    } else {
-      return Attachments.find(
-        { 'meta.cardId': this._id },
-        { sort: { uploadedAt: -1 } },
-      ).each();
+       id = this.linkedId;
     }
+    let ret = Attachments.find(
+      { 'meta.cardId': id },
+      { sort: { uploadedAt: -1 } },
+    ).each();
+    return ret;
   },
 
   cover() {