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() {
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() {