fix(mail(js)): hide sign and encrypt options if not usable

When composing a message, don't offer to sign nor encrypt the message
if user has not uploaded a certificate or if S/MIME is disabled.
This commit is contained in:
Francis Lachapelle
2021-08-12 13:40:47 -04:00
parent 3388c18466
commit eb46415711
4 changed files with 19 additions and 9 deletions
@@ -392,6 +392,16 @@
return identity.textSignature;
};
/**
* @function $hasCertificate
* @memberof Account.prototype
* @desc Return true if the user has a S/MIME certificate for this account
* @returns a boolean value
*/
Account.prototype.$hasCertificate = function() {
return this.security && this.security.hasCertificate;
};
/**
* @function $certificate
* @memberof Account.prototype
@@ -401,7 +411,7 @@
Account.prototype.$certificate = function() {
var _this = this;
if (this.security && this.security.hasCertificate) {
if (this.$hasCertificate()) {
if (this.$$certificate)
return Account.$q.when(this.$$certificate);
else {