From c49293b7f3eff7a478fc388768366e7b025f7da0 Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Wed, 2 Aug 2017 00:05:25 +0200 Subject: [feat] Display mixnet status on outgoing emails --- web-ui/app/js/mail_view/ui/recipients/recipient.js | 20 +++++++++++++++ web-ui/app/scss/base/_colors.scss | 3 +++ web-ui/app/scss/views/_compose-view.scss | 29 ++++++++++++++++++++++ web-ui/app/templates/compose/fixed_recipient.hbs | 2 +- 4 files changed, 53 insertions(+), 1 deletion(-) (limited to 'web-ui/app') diff --git a/web-ui/app/js/mail_view/ui/recipients/recipient.js b/web-ui/app/js/mail_view/ui/recipients/recipient.js index c13a52b1..19866108 100644 --- a/web-ui/app/js/mail_view/ui/recipients/recipient.js +++ b/web-ui/app/js/mail_view/ui/recipients/recipient.js @@ -89,6 +89,25 @@ define( }.bind(this)); }; + this.discoverMixnet = function () { + var p = $.getJSON('/mixnet?search=' + this.attr.address).promise(); + p.done(function (stat) { + switch (stat.status) { + case 'ok': + this.$node.find('.recipient-mixnet').addClass('mixnet'); + break; + case 'unsuported': + this.$node.find('.recipient-mixnet').addClass('unsuported-mixnet'); + break; + default: + this.$node.find('.recipient-mixnet').addClass('not-mixnet'); + } + }.bind(this)); + p.fail(function () { + this.$node.find('.recipient-mixnet').addClass('not-mixnet'); + }.bind(this)); + }; + this.getMailAddress = function() { return this.$node.find('input[type=hidden]').val(); }; @@ -105,6 +124,7 @@ define( this.sinalizeInvalid(); } else { this.discoverEncryption(); + this.discoverMixnet(); } }); } diff --git a/web-ui/app/scss/base/_colors.scss b/web-ui/app/scss/base/_colors.scss index c7807e8f..c23714f1 100644 --- a/web-ui/app/scss/base/_colors.scss +++ b/web-ui/app/scss/base/_colors.scss @@ -59,6 +59,9 @@ $will_be_encrypted: $success; $wont_be_encrypted: $attention; $recipients_font_color: #828282; +$will_be_mixed: $success; +$unsuported_mixed: $light_gray; + /* Attachments */ $attachment_text: #555; $attachment_icon: lighten($attachment_text, 30); diff --git a/web-ui/app/scss/views/_compose-view.scss b/web-ui/app/scss/views/_compose-view.scss index 61e785a0..be193186 100644 --- a/web-ui/app/scss/views/_compose-view.scss +++ b/web-ui/app/scss/views/_compose-view.scss @@ -344,6 +344,35 @@ background-color: $background_light_grey; border: 1px solid $border_light_grey; border-radius: 2px; + + .recipient-mixnet { + &:before { + font-family: FontAwesome; + padding-right: 6px; + font-size: 1.4em; + } + + &.mixnet { + &:before { + color: $will_be_mixed; + content: "\f135"; + } + } + + &.unsuported-mixnet { + &:before { + color: $unsuported_mixed; + content: "\f135"; + } + } + + &.not-mixnet { + &:before { + color: $unsuported_mixed; + content: ""; + } + } + } } .recipient-del { diff --git a/web-ui/app/templates/compose/fixed_recipient.hbs b/web-ui/app/templates/compose/fixed_recipient.hbs index 8b01717c..59efd7e3 100644 --- a/web-ui/app/templates/compose/fixed_recipient.hbs +++ b/web-ui/app/templates/compose/fixed_recipient.hbs @@ -1,7 +1,7 @@
- {{ address }} + {{ address }}
-- cgit v1.2.3