diff options
author | Duda Dornelles <ddornell@thoughtworks.com> | 2015-09-02 18:07:51 -0300 |
---|---|---|
committer | Duda Dornelles <ddornell@thoughtworks.com> | 2015-09-02 18:09:33 -0300 |
commit | 19cda9ca7aa1aca18f61ebf659fc490f8ad4c15a (patch) | |
tree | 96095e86fe90c5505a27f689d515be45146685d7 /web-ui/app | |
parent | d01d60d4d7e9b8bdc7d8741e2567e30c8d476c0b (diff) |
[feature] adding security_casing to LeapMail so we can show in the UI the signature and encryption status
Diffstat (limited to 'web-ui/app')
-rw-r--r-- | web-ui/app/js/mail_view/ui/mail_view.js | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/web-ui/app/js/mail_view/ui/mail_view.js b/web-ui/app/js/mail_view/ui/mail_view.js index 7caf813a..fb640529 100644 --- a/web-ui/app/js/mail_view/ui/mail_view.js +++ b/web-ui/app/js/mail_view/ui/mail_view.js @@ -25,11 +25,10 @@ define( 'mixins/with_hide_and_show', 'mixins/with_mail_tagging', 'page/events', - 'views/i18n', - 'features' + 'views/i18n' ], - function (defineComponent, templates, mailActions, viewHelpers, withHideAndShow, withMailTagging, events, i18n, features) { + function (defineComponent, templates, mailActions, viewHelpers, withHideAndShow, withMailTagging, events, i18n) { return defineComponent(mailView, mailActions, withHideAndShow, withMailTagging); @@ -50,12 +49,8 @@ define( var signed, encrypted; data.mail.security_casing = data.mail.security_casing || {}; - if(features.isEnabled('signatureStatus')) { - signed = this.checkSigned(data.mail); - } - if(features.isEnabled('encryptionStatus')) { - encrypted = this.checkEncrypted(data.mail); - } + signed = this.checkSigned(data.mail); + encrypted = this.checkEncrypted(data.mail); var attachments = _.map(data.mail.attachments, function(a){ return { 'encoding': a.encoding, 'name': a.name, 'ident': a.ident }; @@ -69,7 +64,6 @@ define( tags: data.mail.tags, encryptionStatus: encrypted, signatureStatus: signed, - features: features, attachments: attachments })); @@ -104,16 +98,29 @@ define( var status = ['encrypted']; - if(_.any(mail.security_casing.locks, function (lock) { return lock.state === 'valid'; })) { status.push('encryption-valid'); } - else { status.push('encryption-error'); } + var hasAnyEncryptionInfo = _.any(mail.security_casing.locks, function (lock) { + return lock.state === 'valid'; + }); + + if(hasAnyEncryptionInfo) { + status.push('encryption-valid'); + } else { + status.push('encryption-error'); + } return status.join(' '); }; this.checkSigned = function(mail) { - if(_.isEmpty(mail.security_casing.imprints)) { return 'not-signed'; } + if(_.isEmpty(mail.security_casing.imprints)) { + return 'not-signed'; + } + + var hasNoSignatureInformation = _.any(mail.security_casing.imprints, function (imprint) { + return imprint.state === 'no_signature_information'; + }); - if(_.any(mail.security_casing.imprints, function(imprint) { return imprint.state === 'no_signature_information'; })) { + if(hasNoSignatureInformation) { return ''; } @@ -130,7 +137,6 @@ define( status.push('signature-not-trusted'); } - return status.join(' '); }; |