Skip to content

Commit

Permalink
Only accept 'you left group' messages when group blocked
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnonnenberg-signal committed Sep 17, 2018
1 parent c2e0ec5 commit 814b9cf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions js/background.js
Expand Up @@ -920,9 +920,9 @@
updates.left = true;
}

if (details.blocked === true) {
if (details.blocked) {
storage.addBlockedGroup(id);
} else if (details.blocked === false) {
} else {
storage.removeBlockedGroup(id);
}

Expand Down
14 changes: 10 additions & 4 deletions libtextsecure/message_receiver.js
Expand Up @@ -730,9 +730,12 @@ MessageReceiver.prototype.extend({
const groupId = message.group && message.group.id;
const isBlocked = this.isGroupBlocked(groupId);
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(
`Message ${this.getEnvelopeId(
envelope
Expand Down Expand Up @@ -768,9 +771,12 @@ MessageReceiver.prototype.extend({
const groupId = message.group && message.group.id;
const isBlocked = this.isGroupBlocked(groupId);
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(
`Message ${this.getEnvelopeId(
envelope
Expand Down

0 comments on commit 814b9cf

Please sign in to comment.