Fix notifications of signed + encrypted messages
parent
a35138c0b8
commit
7897ea58fe
|
@ -285,7 +285,7 @@
|
||||||
[NSNumber numberWithBool: [self validSignature]], @"valid",
|
[NSNumber numberWithBool: [self validSignature]], @"valid",
|
||||||
renderedParts, @"content",
|
renderedParts, @"content",
|
||||||
[self smimeCertificates], @"certificates",
|
[self smimeCertificates], @"certificates",
|
||||||
[self validationMessage], @"error",
|
[self validationMessage], @"message",
|
||||||
nil];
|
nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -207,18 +207,18 @@
|
||||||
|
|
||||||
<!-- S/MIME Signature -->
|
<!-- S/MIME Signature -->
|
||||||
<sg-block-toggle class="sg-no-print" layout="column"
|
<sg-block-toggle class="sg-no-print" layout="column"
|
||||||
ng-show="::viewer.message.$smime.certificate">
|
ng-show="::viewer.message.signed">
|
||||||
<md-divider><!-- divider --></md-divider>
|
<md-divider><!-- divider --></md-divider>
|
||||||
<md-list-item class="sg-button-toggle">
|
<md-list-item class="sg-button-toggle">
|
||||||
<div>
|
<div>
|
||||||
<md-icon ng-hide="::viewer.message.$smime.valid"
|
<md-icon ng-hide="::viewer.message.signed.valid"
|
||||||
class="md-warn"
|
class="md-warn"
|
||||||
rsrc:md-svg-src="img/certificate-off.svg"><!-- certificate --></md-icon>
|
rsrc:md-svg-src="img/certificate-off.svg"><!-- certificate --></md-icon>
|
||||||
<md-icon ng-show="::viewer.message.$smime.valid"
|
<md-icon ng-show="::viewer.message.signed.valid"
|
||||||
class="md-accent"
|
class="md-accent"
|
||||||
rsrc:md-svg-src="img/certificate.svg"><!-- certificate --></md-icon>
|
rsrc:md-svg-src="img/certificate.svg"><!-- certificate --></md-icon>
|
||||||
</div>
|
</div>
|
||||||
<p class="md-padding md-flex" ng-bind-html="::viewer.message.$smime.message"><!-- message --></p>
|
<p class="md-padding md-flex" ng-bind-html="::viewer.message.signed.message"><!-- message --></p>
|
||||||
<md-icon class="sg-icon-toggle">expand_more</md-icon>
|
<md-icon class="sg-icon-toggle">expand_more</md-icon>
|
||||||
</md-list-item>
|
</md-list-item>
|
||||||
<div class="sg-block-toggle">
|
<div class="sg-block-toggle">
|
||||||
|
@ -227,7 +227,7 @@
|
||||||
<div flex="50" flex-xs="100">
|
<div flex="50" flex-xs="100">
|
||||||
<div class="md-subhead md-default-theme md-fg md-primary"
|
<div class="md-subhead md-default-theme md-fg md-primary"
|
||||||
ng-bind="::'Subject Name' | loc"><!-- Subject Name --></div>
|
ng-bind="::'Subject Name' | loc"><!-- Subject Name --></div>
|
||||||
<div ng-repeat="field in ::viewer.message.$smime.certificate.subject">
|
<div ng-repeat="field in ::viewer.message.signed.certificate.subject">
|
||||||
<div class="pseudo-input-label" ng-bind="field[0] | loc"><!-- label --></div>
|
<div class="pseudo-input-label" ng-bind="field[0] | loc"><!-- label --></div>
|
||||||
<div class="pseudo-input-field md-body-1" ng-bind="field[1]"><!-- value --></div>
|
<div class="pseudo-input-field md-body-1" ng-bind="field[1]"><!-- value --></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -235,7 +235,7 @@
|
||||||
<div flex="50" flex-xs="100">
|
<div flex="50" flex-xs="100">
|
||||||
<div class="md-subhead md-default-theme md-fg md-primary"
|
<div class="md-subhead md-default-theme md-fg md-primary"
|
||||||
ng-bind="::'Issuer' | loc"><!-- Issuer --></div>
|
ng-bind="::'Issuer' | loc"><!-- Issuer --></div>
|
||||||
<div ng-repeat="field in ::viewer.message.$smime.certificate.issuer">
|
<div ng-repeat="field in ::viewer.message.signed.certificate.issuer">
|
||||||
<div class="pseudo-input-label" ng-bind="field[0] | loc"><!-- label --></div>
|
<div class="pseudo-input-label" ng-bind="field[0] | loc"><!-- label --></div>
|
||||||
<div class="pseudo-input-field md-body-1" ng-bind="field[1]"><!-- value --></div>
|
<div class="pseudo-input-field md-body-1" ng-bind="field[1]"><!-- value --></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -247,14 +247,14 @@
|
||||||
|
|
||||||
<!-- S/MIME Encryption -->
|
<!-- S/MIME Encryption -->
|
||||||
<div class="sg-no-print" layout="column"
|
<div class="sg-no-print" layout="column"
|
||||||
ng-show="viewer.message.$smime.isEncrypted">
|
ng-show="::viewer.message.encrypted">
|
||||||
<md-divider><!-- divider --></md-divider>
|
<md-divider><!-- divider --></md-divider>
|
||||||
<md-list-item>
|
<md-list-item>
|
||||||
<div>
|
<div>
|
||||||
<md-icon ng-show="::viewer.message.$smime.valid">lock_outline</md-icon>
|
<md-icon ng-show="::viewer.message.encrypted.valid">lock_outline</md-icon>
|
||||||
<md-icon ng-hide="::viewer.message.$smime.valid" class="md-warn">lock_outline</md-icon>
|
<md-icon ng-hide="::viewer.message.encrypted.valid" class="md-warn">lock_outline</md-icon>
|
||||||
</div>
|
</div>
|
||||||
<p class="md-padding md-flex" ng-bind-html="::viewer.message.$smime.message"><!-- message --></p>
|
<p class="md-padding md-flex" ng-bind-html="::viewer.message.encrypted.message"><!-- message --></p>
|
||||||
</md-list-item>
|
</md-list-item>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -294,7 +294,7 @@
|
||||||
<div class="msg-body">
|
<div class="msg-body">
|
||||||
<div layout="row" layout-wrap="layout-wrap">
|
<div layout="row" layout-wrap="layout-wrap">
|
||||||
<div class="mailer_mailcontent" layout="row" layout-wrap="layout-wrap"
|
<div class="mailer_mailcontent" layout="row" layout-wrap="layout-wrap"
|
||||||
ng-repeat="part in viewer.message.$content()"
|
ng-repeat="part in viewer.message.$content() track by $index"
|
||||||
ng-class="::part.msgclass">
|
ng-class="::part.msgclass">
|
||||||
<div class="md-flex sg-mail-part"
|
<div class="md-flex sg-mail-part"
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
|
|
|
@ -274,6 +274,7 @@
|
||||||
*/
|
*/
|
||||||
Message.prototype.loadUnsafeContent = function() {
|
Message.prototype.loadUnsafeContent = function() {
|
||||||
this.$loadUnsafeContent = true;
|
this.$loadUnsafeContent = true;
|
||||||
|
delete this.$parts;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -295,24 +296,20 @@
|
||||||
// Can be used for UIxMailPartMixedViewer, UIxMailPartMessageViewer, and UIxMailPartSignedViewer
|
// Can be used for UIxMailPartMixedViewer, UIxMailPartMessageViewer, and UIxMailPartSignedViewer
|
||||||
else if (angular.isArray(part.content)) {
|
else if (angular.isArray(part.content)) {
|
||||||
if (part.type == 'UIxMailPartSignedViewer' && part['supports-smime'] === 1) {
|
if (part.type == 'UIxMailPartSignedViewer' && part['supports-smime'] === 1) {
|
||||||
// First line in a h1, others each in a p
|
_this.signed = {
|
||||||
var formattedMessage = "<p>" + part.error.replace(/\n/, "</p><p class=\"md-caption\">");
|
|
||||||
formattedMessage = formattedMessage.replace(/\n/g, "</p><p class=\"md-caption\">") + "</p>";
|
|
||||||
_this.$smime = {
|
|
||||||
valid: part.valid,
|
valid: part.valid,
|
||||||
certificate: part.certificates[part.certificates.length - 1],
|
certificate: part.certificates[part.certificates.length - 1],
|
||||||
message: formattedMessage
|
message: part.message
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if (part.type == 'UIxMailPartEncryptedViewer') {
|
else if (part.type == 'UIxMailPartEncryptedViewer') {
|
||||||
_this.$smime = {
|
_this.encrypted = {
|
||||||
isEncrypted: true,
|
|
||||||
valid: part.valid
|
valid: part.valid
|
||||||
};
|
};
|
||||||
if (part.valid)
|
if (part.valid)
|
||||||
_this.$smime.message = l("This message is encrypted");
|
_this.encrypted.message = l("This message is encrypted");
|
||||||
else
|
else
|
||||||
_this.$smime.message = l("This message can't be decrypted. Please make sure you have uploaded your S/MIME certificate from the mail preferences module.");
|
_this.encrypted.message = l("This message can't be decrypted. Please make sure you have uploaded your S/MIME certificate from the mail preferences module.");
|
||||||
}
|
}
|
||||||
_.forEach(part.content, function(mixedPart) {
|
_.forEach(part.content, function(mixedPart) {
|
||||||
_visit(mixedPart);
|
_visit(mixedPart);
|
||||||
|
@ -372,9 +369,16 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.parts)
|
if (this.$parts)
|
||||||
|
// Use the cache
|
||||||
|
return this.$parts;
|
||||||
|
|
||||||
|
else if (this.parts)
|
||||||
_visit(this.parts);
|
_visit(this.parts);
|
||||||
|
|
||||||
|
// Cache result
|
||||||
|
this.$parts = parts;
|
||||||
|
|
||||||
return parts;
|
return parts;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -653,6 +657,13 @@
|
||||||
// Fetch draft initial data
|
// Fetch draft initial data
|
||||||
return Message.$$resource.fetch(message.$absolutePath({asDraft: true}), 'edit').then(function(data) {
|
return Message.$$resource.fetch(message.$absolutePath({asDraft: true}), 'edit').then(function(data) {
|
||||||
Message.$log.debug('New ' + action + ': ' + JSON.stringify(data, undefined, 2) + ' original UID: ' + _this.uid);
|
Message.$log.debug('New ' + action + ': ' + JSON.stringify(data, undefined, 2) + ' original UID: ' + _this.uid);
|
||||||
|
var accountDefaults = Message.$Preferences.defaults.AuxiliaryMailAccounts[_this.$mailbox.$account.id];
|
||||||
|
if (accountDefaults.security) {
|
||||||
|
if (accountDefaults.security.alwaysSign)
|
||||||
|
data.sign = true;
|
||||||
|
if (accountDefaults.security.alwaysEncrypt)
|
||||||
|
data.encrypt = true;
|
||||||
|
}
|
||||||
angular.extend(message.editable, data);
|
angular.extend(message.editable, data);
|
||||||
|
|
||||||
// We keep a reference to our original message in order to update the flags
|
// We keep a reference to our original message in order to update the flags
|
||||||
|
|
Loading…
Reference in New Issue