snappymail/dev/Model/MessageCollection.js

46 lines
900 B
JavaScript
Raw Normal View History

import { AbstractCollectionModel } from 'Model/AbstractCollection';
import { MessageModel } from 'Model/Message';
import {
MessageFlagsCache
} from 'Common/Cache';
'use strict';
export class MessageCollectionModel extends AbstractCollectionModel
{
/*
constructor() {
super();
this.Filtered
this.Folder
this.FolderHash
2022-06-03 19:47:04 +08:00
this.FolderInfo
this.totalEmails
this.unreadEmails
this.MessageResultCount
2022-06-03 19:47:04 +08:00
this.UidNext
this.ThreadUid
this.NewMessages
this.Offset
2022-06-03 19:47:04 +08:00
this.Limit
this.Search
}
*/
/**
* @param {?Object} json
* @returns {MessageCollectionModel}
*/
static reviveFromJson(object, cached) {
2020-10-18 17:46:22 +08:00
return super.reviveFromJson(object, message => {
message = MessageModel.reviveFromJson(message);
if (message) {
message.deleted(false);
cached ? MessageFlagsCache.initMessage(message) : MessageFlagsCache.store(message);
return message;
2020-10-18 17:46:22 +08:00
}
});
}
}