mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-15 16:35:35 +00:00
feat(mail): new option to force default identity
Users can now force the default identity to always be used when replying or forwarding a message.
This commit is contained in:
@@ -480,7 +480,7 @@
|
||||
* @return an object literal copy of the Account instance
|
||||
*/
|
||||
Account.prototype.$omit = function () {
|
||||
var account = {}, identities = [];
|
||||
var account = {}, identities = [], defaultIdentity = false;
|
||||
|
||||
angular.forEach(this, function(value, key) {
|
||||
if (key != 'constructor' && key !='identities' && key[0] != '$') {
|
||||
@@ -491,9 +491,14 @@
|
||||
_.forEach(this.identities, function (identity) {
|
||||
if (!identity.isReadOnly)
|
||||
identities.push(_.pick(identity, ['email', 'fullName', 'replyTo', 'signature', 'isDefault']));
|
||||
if (identity.isDefault)
|
||||
defaultIdentity = identity;
|
||||
});
|
||||
account.identities = identities;
|
||||
|
||||
if (!defaultIdentity || !account.forceDefaultIdentity)
|
||||
delete account.forceDefaultIdentity;
|
||||
|
||||
return account;
|
||||
};
|
||||
|
||||
|
||||
@@ -74,6 +74,10 @@
|
||||
}
|
||||
};
|
||||
|
||||
this.hasDefaultIdentity = function() {
|
||||
return _.findIndex(this.account.identities, function(identity) { return !!identity.isDefault; }) >= 0;
|
||||
};
|
||||
|
||||
this.setDefaultIdentity = function ($event, $index) {
|
||||
_.forEach(this.account.identities, function(identity, i) {
|
||||
if (i == $index)
|
||||
|
||||
Reference in New Issue
Block a user