diff --git a/js/libtextsecure.js b/js/libtextsecure.js index fdc526b2..19f3a687 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -37062,7 +37062,11 @@ MessageReceiver.prototype = { case textsecure.protobuf.GroupContext.Type.QUIT: decrypted.body = null; 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: decrypted.group.name = null; decrypted.group.members = []; @@ -37073,7 +37077,7 @@ MessageReceiver.prototype = { throw new Error("Unknown group message type"); } } - })); + }.bind(this))); } for (var i in decrypted.attachments) { diff --git a/js/models/messages.js b/js/models/messages.js index 061ddfd3..1f85fd99 100644 --- a/js/models/messages.js +++ b/js/models/messages.js @@ -280,7 +280,11 @@ } } 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); } diff --git a/libtextsecure/message_receiver.js b/libtextsecure/message_receiver.js index f2ca08f7..4b70fdc2 100644 --- a/libtextsecure/message_receiver.js +++ b/libtextsecure/message_receiver.js @@ -331,7 +331,11 @@ MessageReceiver.prototype = { case textsecure.protobuf.GroupContext.Type.QUIT: decrypted.body = null; 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: decrypted.group.name = null; decrypted.group.members = []; @@ -342,7 +346,7 @@ MessageReceiver.prototype = { throw new Error("Unknown group message type"); } } - })); + }.bind(this))); } for (var i in decrypted.attachments) {