Ensure that blocked messages are dropped even after sealed sender

This commit is contained in:
Scott Nonnenberg 2019-01-22 14:49:36 -08:00
parent 51f1ef5725
commit 91ef39e482

View file

@ -725,6 +725,13 @@ MessageReceiver.prototype.extend({
return { isMe: true };
}
if (this.isBlocked(sender.getName())) {
window.log.info(
'Dropping blocked message after sealed sender decryption'
);
return { isBlocked: true };
}
// Here we take this sender information and attach it back to the envelope
// to make the rest of the app work properly.
@ -747,6 +754,13 @@ MessageReceiver.prototype.extend({
if (sender) {
const originalSource = envelope.source;
if (this.isBlocked(sender.getName())) {
window.log.info(
'Dropping blocked message with error after sealed sender decryption'
);
return { isBlocked: true };
}
// eslint-disable-next-line no-param-reassign
envelope.source = sender.getName();
// eslint-disable-next-line no-param-reassign
@ -769,8 +783,8 @@ MessageReceiver.prototype.extend({
return promise
.then(plaintext => {
const { isMe } = plaintext || {};
if (isMe) {
const { isMe, isBlocked } = plaintext || {};
if (isMe || isBlocked) {
return this.removeFromCache(envelope);
}