Identities refactoring and improvements (Reply-To and BCC)

This commit is contained in:
RainLoop Team 2015-02-06 19:26:20 +04:00
parent 3e01887f85
commit 493191375f
43 changed files with 578 additions and 1051 deletions

View file

@ -28,8 +28,8 @@
this.count = ko.observable(iCount || 0);
this.deleteAccess = ko.observable(false);
this.canBeDalete = ko.observable(Utils.isUnd(bCanBeDelete) ? true : !!bCanBeDelete);
this.canBeEdit = this.canBeDalete;
this.canBeDeleted = ko.observable(Utils.isUnd(bCanBeDelete) ? true : !!bCanBeDelete);
this.canBeEdit = this.canBeDeleted;
}
_.extend(AccountModel.prototype, AbstractModel.prototype);

View file

@ -140,7 +140,7 @@
this.regDisposables([this.actionNoStop, this.actionTemplate]);
this.deleteAccess = ko.observable(false);
this.canBeDalete = ko.observable(true);
this.canBeDeleted = ko.observable(true);
}
_.extend(FilterModel.prototype, AbstractModel.prototype);

View file

@ -15,41 +15,35 @@
/**
* @param {string} sId
* @param {string} sEmail
* @param {boolean=} bCanBeDelete = true
* @constructor
*/
function IdentityModel(sId, sEmail, bCanBeDelete)
function IdentityModel(sId, sEmail)
{
AbstractModel.call(this, 'IdentityModel');
this.id = sId;
this.id = ko.observable(sId);
this.email = ko.observable(sEmail);
this.name = ko.observable('');
this.replyTo = ko.observable('');
this.bcc = ko.observable('');
this.deleteAccess = ko.observable(false);
this.canBeDalete = ko.observable(bCanBeDelete);
this.canBeDeleted = ko.computed(function () {
return '' !== this.id();
}, this);
}
_.extend(IdentityModel.prototype, AbstractModel.prototype);
IdentityModel.prototype.formattedName = function ()
{
var sName = this.name();
return '' === sName ? this.email() : sName + ' <' + this.email() + '>';
};
var
sName = this.name(),
sEmail = this.email()
;
IdentityModel.prototype.formattedNameForCompose = function ()
{
var sName = this.name();
return '' === sName ? this.email() : sName + ' (' + this.email() + ')';
};
IdentityModel.prototype.formattedNameForEmail = function ()
{
var sName = this.name();
return '' === sName ? this.email() : '"' + Utils.quoteName(sName) + '" <' + this.email() + '>';
return ('' !== sName) ? sName + ' (' + sEmail + ')' : sEmail;
};
module.exports = IdentityModel;

View file

@ -608,6 +608,16 @@
return MessageModel.emailsToLine(this.bcc, bFriendlyView, bWrapWithLink);
};
/**
* @param {boolean} bFriendlyView
* @param {boolean=} bWrapWithLink = false
* @return {string}
*/
MessageModel.prototype.replyToToLine = function (bFriendlyView, bWrapWithLink)
{
return MessageModel.emailsToLine(this.replyTo, bFriendlyView, bWrapWithLink);
};
/**
* @return string
*/
@ -867,6 +877,7 @@
'popupTo': this.toToLine(false),
'popupCc': this.ccToLine(false),
'popupBcc': this.bccToLine(false),
'popupReplyTo': this.replyToToLine(false),
'popupSubject': this.subject(),
'popupIsHtml': this.isHtml(),
'popupDate': this.fullFormatDateValue(),