cidWithOutTags => cidWithoutTags and don't check foundedCIDs because isLinked is already set

This commit is contained in:
djmaze 2020-09-20 11:15:00 +02:00
parent 6d5317d969
commit 46198861bc
2 changed files with 7 additions and 7 deletions

View file

@ -9,15 +9,12 @@ export class AttachmentCollectionModel extends AbstractCollectionModel
* @param {?Array} json
* @returns {AttachmentCollectionModel}
*/
static reviveFromJson(items, foundedCIDs) {
static reviveFromJson(items) {
let result = new AttachmentCollectionModel;
items = this.getFromJSON(items, 'AttachmentCollection') || items;
Array.isArray(items) && items.forEach(attachment => {
attachment = AttachmentModel.newInstanceFromJson(attachment);
if (attachment) {
if (attachment.cidWithOutTags && foundedCIDs.includes(attachment.cidWithOutTags)) {
attachment.isLinked = true;
}
result.push(attachment);
}
});
@ -37,6 +34,6 @@ export class AttachmentCollectionModel extends AbstractCollectionModel
*/
findByCid(cid) {
cid = cid.replace(/^<+|>+$/, '');
return this.find(item => cid === item.cidWithOutTags);
return this.find(item => cid === item.cidWithoutTags);
}
}