Only accept 'you left group' messages when group blocked

pull/27/head^2
Scott Nonnenberg 7 years ago
parent c2e0ec5636
commit 814b9cf26a

@ -920,9 +920,9 @@
updates.left = true; updates.left = true;
} }
if (details.blocked === true) { if (details.blocked) {
storage.addBlockedGroup(id); storage.addBlockedGroup(id);
} else if (details.blocked === false) { } else {
storage.removeBlockedGroup(id); storage.removeBlockedGroup(id);
} }

@ -730,9 +730,12 @@ MessageReceiver.prototype.extend({
const groupId = message.group && message.group.id; const groupId = message.group && message.group.id;
const isBlocked = this.isGroupBlocked(groupId); const isBlocked = this.isGroupBlocked(groupId);
const isMe = envelope.source === textsecure.storage.user.getNumber(); const isMe = envelope.source === textsecure.storage.user.getNumber();
const hasGroupMetadata = Boolean(message.group); const isLeavingGroup = Boolean(
message.group &&
message.group.type === textsecure.protobuf.GroupContext.Type.QUIT
);
if (groupId && isBlocked && !(isMe && hasGroupMetadata)) { if (groupId && isBlocked && !(isMe && isLeavingGroup)) {
window.log.warn( window.log.warn(
`Message ${this.getEnvelopeId( `Message ${this.getEnvelopeId(
envelope envelope
@ -768,9 +771,12 @@ MessageReceiver.prototype.extend({
const groupId = message.group && message.group.id; const groupId = message.group && message.group.id;
const isBlocked = this.isGroupBlocked(groupId); const isBlocked = this.isGroupBlocked(groupId);
const isMe = envelope.source === textsecure.storage.user.getNumber(); const isMe = envelope.source === textsecure.storage.user.getNumber();
const hasGroupMetadata = Boolean(message.group); const isLeavingGroup = Boolean(
message.group &&
message.group.type === textsecure.protobuf.GroupContext.Type.QUIT
);
if (groupId && isBlocked && !(isMe && hasGroupMetadata)) { if (groupId && isBlocked && !(isMe && isLeavingGroup)) {
window.log.warn( window.log.warn(
`Message ${this.getEnvelopeId( `Message ${this.getEnvelopeId(
envelope envelope

Loading…
Cancel
Save