mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-09 17:37:02 +03:00
Let all the new CollectionModels use AbstractCollectionModel
This commit is contained in:
parent
086a2c1927
commit
71f6fb25e5
5 changed files with 39 additions and 44 deletions
|
|
@ -1,22 +1,17 @@
|
|||
import { AbstractCollectionModel } from 'Model/AbstractCollection';
|
||||
import { AttachmentModel } from 'Model/Attachment';
|
||||
|
||||
'use strict';
|
||||
|
||||
class AttachmentCollectionModel extends Array
|
||||
export class AttachmentCollectionModel extends AbstractCollectionModel
|
||||
{
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {?Array} json
|
||||
* @returns {AttachmentCollectionModel}
|
||||
*/
|
||||
static reviveFromJson(items, foundedCIDs) {
|
||||
let result = new AttachmentCollectionModel;
|
||||
if (items && 'Collection/AttachmentCollection' === items['@Object']) {
|
||||
items = items['@Collection'];
|
||||
}
|
||||
items = this.getFromJSON(items, 'AttachmentCollection') || items;
|
||||
Array.isArray(items) && items.forEach(attachment => {
|
||||
attachment = AttachmentModel.newInstanceFromJson(attachment);
|
||||
if (attachment) {
|
||||
|
|
@ -45,5 +40,3 @@ class AttachmentCollectionModel extends Array
|
|||
return this.find(item => cid === item.cidWithOutTags);
|
||||
}
|
||||
}
|
||||
|
||||
export { AttachmentCollectionModel, AttachmentCollectionModel as default };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue