Attachment selection, simpler code logic

This commit is contained in:
Martin Filser 2022-04-26 19:30:27 +02:00
parent 11f8b17a05
commit b6374dac3d

View file

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