mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-02 21:12:02 +08:00
e265a0f1c1
Now we can properly parse PGP/MIME HTML messages
38 lines
951 B
JavaScript
38 lines
951 B
JavaScript
import { AbstractCollectionModel } from 'Model/AbstractCollection';
|
|
import { AttachmentModel } from 'Model/Attachment';
|
|
|
|
'use strict';
|
|
|
|
export class AttachmentCollectionModel extends AbstractCollectionModel
|
|
{
|
|
/**
|
|
* @param {?Array} json
|
|
* @returns {AttachmentCollectionModel}
|
|
*/
|
|
static reviveFromJson(items) {
|
|
return super.reviveFromJson(items, attachment => AttachmentModel.reviveFromJson(attachment));
|
|
/*
|
|
const attachments = super.reviveFromJson(items, attachment => AttachmentModel.reviveFromJson(attachment));
|
|
if (attachments) {
|
|
attachments.InlineCount = attachments.reduce((accumulator, a) => accumulator + (a.isInline ? 1 : 0), 0);
|
|
}
|
|
return attachments;
|
|
*/
|
|
}
|
|
|
|
/**
|
|
* @returns {boolean}
|
|
*/
|
|
hasVisible() {
|
|
return !!this.find(item => !item.isLinked);
|
|
}
|
|
|
|
/**
|
|
* @param {string} cid
|
|
* @returns {*}
|
|
*/
|
|
findByCid(cid) {
|
|
cid = cid.replace(/^<+|>+$/g, '');
|
|
return this.find(item => cid === item.contentId());
|
|
}
|
|
}
|