Skip to content

Commit

Permalink
feat(mail): handle multiple mail identities
Browse files Browse the repository at this point in the history
Fixes #768, fixes #4602
  • Loading branch information
cgx committed Jul 10, 2020
1 parent 3d25b8b commit b4f76a7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion UI/Templates/MailerUI/UIxMailEditor.wox
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
md-highlight-flags="gi">{{ identity.full }}</span>
</div>
<div class="sg-md-body">
<i ng-bind-html="editor.account.getTextSignature($index)"><!-- signature --></i>
<i ng-bind-html="editor.account.getTextSignature(identity)"><!-- signature --></i>
</div>
</div>
</md-item-template>
Expand Down
2 changes: 1 addition & 1 deletion UI/Templates/PreferencesUI/UIxAccountEditor.wox
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
</div>
</div>
<div class="sg-md-body">
<i ng-bind-html="$AccountDialogController.account.getTextSignature($index)"><!-- signature --></i>
<i ng-bind-html="$AccountDialogController.account.getTextSignature(identity)"><!-- signature --></i>
</div>
</div>
<md-button class="sg-icon-button" type="button"
Expand Down
17 changes: 6 additions & 11 deletions UI/WebServerResources/js/Mailer/Account.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,19 +327,14 @@
* @desc Create a plain text representation of the signature for the specified identity index.
* @returns a plain text version of the signature
*/
Account.prototype.getTextSignature = function(index) {
if (index < this.identities.length) {
var identity = this.identities[index];
if (identity.signature) {
var element = angular.element('<div>' + identity.signature + '</div>');
identity.textSignature = _.map(element.contents(), 'textContent').join(' ').trim();
} else {
identity.textSignature = '';
}
return identity.textSignature;
Account.prototype.getTextSignature = function(identity) {
if (identity.signature) {
var element = angular.element('<div>' + identity.signature + '</div>');
identity.textSignature = _.map(element.contents(), 'textContent').join(' ').trim();
} else {
throw Error('Index of identity is out of range');
identity.textSignature = '';
}
return identity.textSignature;
};

/**
Expand Down

0 comments on commit b4f76a7

Please sign in to comment.