From c52ce25ac49cdfdc1791bcb65c5262aec63dadbd Mon Sep 17 00:00:00 2001 From: Duda Dornelles Date: Fri, 13 Feb 2015 10:27:51 -0200 Subject: Adding encryption info for a recipient when composing. To do that we look into the KeysResouce to see if we will find a key for each address entered for the recipients. --- web-ui/app/js/mail_view/ui/recipients/recipient.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'web-ui/app/js/mail_view/ui/recipients/recipient.js') 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 004b9247..c14f36b2 100644 --- a/web-ui/app/js/mail_view/ui/recipients/recipient.js +++ b/web-ui/app/js/mail_view/ui/recipients/recipient.js @@ -32,6 +32,7 @@ define( html.insertBefore(nodeToPrependTo.children().last()); var component = new this.constructor(); component.initialize(html, recipient); + component.attr.recipient = recipient; return component; }; @@ -47,6 +48,24 @@ define( this.doUnselect = function () { this.$node.find('.recipient-value').removeClass('selected'); }; + + this.discoverEncryption = function () { + this.$node.addClass('discorver-encryption'); + var p = $.getJSON('/keys?search=' + this.attr.address).promise(); + p.done(function () { + this.$node.addClass('encrypted'); + this.$node.removeClass('discorver-encryption') + }.bind(this)); + p.fail(function () { + this.$node.addClass('not-encrypted'); + this.$node.removeClass('discorver-encryption') + }.bind(this)); + + }; + + this.after('initialize', function () { + this.discoverEncryption(); + }); } } ); -- cgit v1.2.3