Handle group quit sync messages
Previously, we would incorrectly reject group updates originating from a linked device instructing us to remove ourselves from the group. // FREEBIE
This commit is contained in:
parent
edcb28aebb
commit
2f469835d9
3 changed files with 17 additions and 5 deletions
|
@ -37062,7 +37062,11 @@ MessageReceiver.prototype = {
|
||||||
case textsecure.protobuf.GroupContext.Type.QUIT:
|
case textsecure.protobuf.GroupContext.Type.QUIT:
|
||||||
decrypted.body = null;
|
decrypted.body = null;
|
||||||
decrypted.attachments = [];
|
decrypted.attachments = [];
|
||||||
return textsecure.storage.groups.removeNumber(decrypted.group.id, source);
|
if (source === this.number) {
|
||||||
|
return textsecure.storage.groups.deleteGroup(decrypted.group.id);
|
||||||
|
} else {
|
||||||
|
return textsecure.storage.groups.removeNumber(decrypted.group.id, source);
|
||||||
|
}
|
||||||
case textsecure.protobuf.GroupContext.Type.DELIVER:
|
case textsecure.protobuf.GroupContext.Type.DELIVER:
|
||||||
decrypted.group.name = null;
|
decrypted.group.name = null;
|
||||||
decrypted.group.members = [];
|
decrypted.group.members = [];
|
||||||
|
@ -37073,7 +37077,7 @@ MessageReceiver.prototype = {
|
||||||
throw new Error("Unknown group message type");
|
throw new Error("Unknown group message type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}));
|
}.bind(this)));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i in decrypted.attachments) {
|
for (var i in decrypted.attachments) {
|
||||||
|
|
|
@ -280,7 +280,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (dataMessage.group.type === textsecure.protobuf.GroupContext.Type.QUIT) {
|
else if (dataMessage.group.type === textsecure.protobuf.GroupContext.Type.QUIT) {
|
||||||
group_update = { left: source };
|
if (source == textsecure.storage.user.getNumber()) {
|
||||||
|
group_update = { left: "You" };
|
||||||
|
} else {
|
||||||
|
group_update = { left: source };
|
||||||
|
}
|
||||||
attributes.members = _.without(conversation.get('members'), source);
|
attributes.members = _.without(conversation.get('members'), source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -331,7 +331,11 @@ MessageReceiver.prototype = {
|
||||||
case textsecure.protobuf.GroupContext.Type.QUIT:
|
case textsecure.protobuf.GroupContext.Type.QUIT:
|
||||||
decrypted.body = null;
|
decrypted.body = null;
|
||||||
decrypted.attachments = [];
|
decrypted.attachments = [];
|
||||||
return textsecure.storage.groups.removeNumber(decrypted.group.id, source);
|
if (source === this.number) {
|
||||||
|
return textsecure.storage.groups.deleteGroup(decrypted.group.id);
|
||||||
|
} else {
|
||||||
|
return textsecure.storage.groups.removeNumber(decrypted.group.id, source);
|
||||||
|
}
|
||||||
case textsecure.protobuf.GroupContext.Type.DELIVER:
|
case textsecure.protobuf.GroupContext.Type.DELIVER:
|
||||||
decrypted.group.name = null;
|
decrypted.group.name = null;
|
||||||
decrypted.group.members = [];
|
decrypted.group.members = [];
|
||||||
|
@ -342,7 +346,7 @@ MessageReceiver.prototype = {
|
||||||
throw new Error("Unknown group message type");
|
throw new Error("Unknown group message type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}));
|
}.bind(this)));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i in decrypted.attachments) {
|
for (var i in decrypted.attachments) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue