mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-11 00:14:50 +03:00
Code refactoring
This commit is contained in:
parent
ffde4f03a8
commit
b7709c8117
21 changed files with 291 additions and 192 deletions
|
|
@ -71,7 +71,7 @@
|
|||
};
|
||||
|
||||
/**
|
||||
* @param {AjaxJsonMessage} oJson
|
||||
* @param {Object} oJson
|
||||
* @return {boolean}
|
||||
*/
|
||||
MessageSimpleModel.prototype.initByJson = function (oJson)
|
||||
|
|
@ -85,14 +85,16 @@
|
|||
|
||||
this.subject = Utils.pString(oJson.Subject);
|
||||
|
||||
this.subjectPrefix = '';
|
||||
this.subjectSuffix = this.subject;
|
||||
|
||||
if (Utils.isArray(oJson.SubjectParts))
|
||||
{
|
||||
this.subjectPrefix = Utils.pString(oJson.SubjectParts[0]);
|
||||
this.subjectSuffix = Utils.pString(oJson.SubjectParts[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.subjectPrefix = '';
|
||||
this.subjectSuffix = this.subject;
|
||||
}
|
||||
|
||||
this.from = MessageHelper.emailArrayFromJson(oJson.From);
|
||||
this.to = MessageHelper.emailArrayFromJson(oJson.To);
|
||||
|
|
@ -132,7 +134,7 @@
|
|||
|
||||
/**
|
||||
* @static
|
||||
* @param {AjaxJsonMessage} oJson
|
||||
* @param {Object} oJson
|
||||
* @return {?MessageSimpleModel}
|
||||
*/
|
||||
MessageSimpleModel.newInstanceFromJson = function (oJson)
|
||||
|
|
|
|||
|
|
@ -1,66 +0,0 @@
|
|||
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
// Enums = require('Common/Enums'),
|
||||
// Utils = require('Common/Utils'),
|
||||
//
|
||||
// MessageHelper = require('Helper/Message'),
|
||||
|
||||
AbstractModel = require('Knoin/AbstractModel')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function MessageStatesModel()
|
||||
{
|
||||
AbstractModel.call(this, 'MessageStatesModel');
|
||||
|
||||
this.flags = {};
|
||||
this.states = {};
|
||||
|
||||
this.flags.unseen = ko.observable(false);
|
||||
this.flags.deleted = ko.observable(false);
|
||||
this.flags.flagged = ko.observable(false);
|
||||
this.flags.answered = ko.observable(false);
|
||||
this.flags.forwarded = ko.observable(false);
|
||||
|
||||
this.states.checked = ko.observable(false);
|
||||
this.states.deleted = ko.observable(false);
|
||||
this.states.selected = ko.observable(false);
|
||||
this.states.focused = ko.observable(false);
|
||||
|
||||
this.states.showReadReceipt = ko.observable(false);
|
||||
this.states.showExternalImages = ko.observable(false);
|
||||
|
||||
this.states.hasUnseenSubMessages = ko.observable(false);
|
||||
this.states.hasFlaggedSubMessages = ko.observable(false);
|
||||
|
||||
this.threads = ko.observableArray([]);
|
||||
}
|
||||
|
||||
_.extend(MessageStatesModel.prototype, AbstractModel.prototype);
|
||||
|
||||
MessageStatesModel.prototype.flags = {};
|
||||
MessageStatesModel.prototype.states = {};
|
||||
|
||||
MessageStatesModel.prototype.clear = function ()
|
||||
{
|
||||
this.flags.unseen(false);
|
||||
this.flags.deleted(false);
|
||||
this.flags.flagged(false);
|
||||
this.flags.answered(false);
|
||||
this.flags.forwarded(false);
|
||||
|
||||
this.threads([]);
|
||||
};
|
||||
|
||||
module.exports = MessageStatesModel;
|
||||
|
||||
}());
|
||||
Loading…
Add table
Add a link
Reference in a new issue