diff --git a/dev/Model/Message.js b/dev/Model/Message.js index 312091532..31772c996 100644 --- a/dev/Model/Message.js +++ b/dev/Model/Message.js @@ -201,7 +201,19 @@ */ MessageModel.prototype.getRecipientsEmails = function () { - return _.compact(_.uniq(_.map(this.to.concat(this.cc), function (oItem) { + return this.getEmails(['to', 'cc']); + }; + + /** + * @param {Array} aProperties + * @return {Array} + */ + MessageModel.prototype.getEmails = function (aProperties) + { + var self = this; + return _.compact(_.uniq(_.map(_.reduce(aProperties, function (aCarry, sProperty) { + return aCarry.concat(self[sProperty]); + }, []), function (oItem) { return oItem ? oItem.email : ''; }))); }; @@ -1033,4 +1045,4 @@ module.exports = MessageModel; -}()); \ No newline at end of file +}()); diff --git a/dev/Stores/User/Pgp.js b/dev/Stores/User/Pgp.js index b24ce9e29..0fd9c43ae 100644 --- a/dev/Stores/User/Pgp.js +++ b/dev/Stores/User/Pgp.js @@ -292,7 +292,7 @@ bEncrypted = mDom.hasClass('encrypted'), bSigned = mDom.hasClass('signed'), oVerControl = null, - aRecipients = oRainLoopMessage ? oRainLoopMessage.getRecipientsEmails() : [], + aRecipients = oRainLoopMessage ? oRainLoopMessage.getEmails(['from', 'to', 'cc']) : [], sData = '' ; diff --git a/dev/Styles/OpenPgpKey.less b/dev/Styles/OpenPgpKey.less index 6193ced85..090f14f64 100644 --- a/dev/Styles/OpenPgpKey.less +++ b/dev/Styles/OpenPgpKey.less @@ -62,6 +62,10 @@ &-delete { cursor: pointer; + + &.disabled { + cursor: not-allowed; + } } &-names { @@ -121,14 +125,14 @@ &__name { border-bottom: 1px solid transparent; - - &:hover { - border-bottom: 1px dashed #555; - } } &__names { display: inline-block; + + &:hover .key-list__item__name { + border-bottom: 1px dashed #555; + } } } } diff --git a/dev/Styles/_FontasticToBoot.less b/dev/Styles/_FontasticToBoot.less index 52d8db353..8b562a34c 100644 --- a/dev/Styles/_FontasticToBoot.less +++ b/dev/Styles/_FontasticToBoot.less @@ -7,6 +7,11 @@ line-height: 17px; font-size: 16px; vertical-align: text-top; + + &.disabled, + .disabled & { + color: grey; + } } .icon-folder, .icon-folder-add, .icon-list { diff --git a/dev/View/Popup/ComposeOpenPgp.js b/dev/View/Popup/ComposeOpenPgp.js index 4001fc335..a6a72f9e5 100644 --- a/dev/View/Popup/ComposeOpenPgp.js +++ b/dev/View/Popup/ComposeOpenPgp.js @@ -248,6 +248,7 @@ aKeys.push({ 'empty': !oOption.key, 'selected': ko.observable(!!oOption.key), + 'removable': this.signKey().id !== oOption.key.id, 'users': oOption.key.users, 'hash': oOption.key.id.substr(-8).toUpperCase(), 'key': oOption.key @@ -372,6 +373,7 @@ if (oIdentity && oIdentity.email()) { sEmail = oIdentity.email(); + aRec.unshift(sEmail); oKey = PgpStore.findPrivateKeyByEmailNotNative(sEmail); if (oKey) { @@ -390,16 +392,19 @@ if (aRec && 0 < aRec.length) { - this.encryptKeys(_.compact(_.map(aRec, function (sEmail) { + this.encryptKeys(_.uniq(_.compact(_.map(aRec, function (sEmail) { var oKey = PgpStore.findPublicKeyByEmailNotNative(sEmail) || null; return { 'empty': !oKey, 'selected': ko.observable(!!oKey), + 'removable': oIdentity && oIdentity.email() && oIdentity.email() !== sEmail, 'users': oKey ? (oKey.users || [sEmail]) : [sEmail], 'hash': oKey ? oKey.id.substr(-8).toUpperCase() : '', 'key': oKey }; - }))); + })), function (oEncryptKey) { + return oEncryptKey.hash; + })); if (0 < this.encryptKeys().length) { diff --git a/rainloop/v/0.0.0/app/templates/Views/User/PopupsComposeOpenPgp.html b/rainloop/v/0.0.0/app/templates/Views/User/PopupsComposeOpenPgp.html index d8b3704b9..7ea3d0d1c 100644 --- a/rainloop/v/0.0.0/app/templates/Views/User/PopupsComposeOpenPgp.html +++ b/rainloop/v/0.0.0/app/templates/Views/User/PopupsComposeOpenPgp.html @@ -59,7 +59,7 @@