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