diff --git a/js/libtextsecure.js b/js/libtextsecure.js index df884ab3..289b2d6d 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -36987,19 +36987,9 @@ Internal.SessionLock.queueJobForNumber = function queueJobForNumber(number, runJ if (numbers.filter(textsecure.utils.isNumberSane).length < numbers.length) throw new Error("Invalid number in new group members"); - if (group.numbers.filter(function(number) { return numbers.indexOf(number) < 0 }).length > 0) - throw new Error("Attempted to remove numbers from group with an UPDATE"); - var added = numbers.filter(function(number) { return group.numbers.indexOf(number) < 0; }); - return textsecure.storage.groups.addNumbers(groupId, added).then(function(newGroup) { - if (numbers.filter(function(number) { return newGroup.indexOf(number) < 0; }).length != 0 || - newGroup.filter(function(number) { return numbers.indexOf(number) < 0; }).length != 0) { - throw new Error("Error calculating group member difference"); - } - - return added; - }); + return textsecure.storage.groups.addNumbers(groupId, added); }); }, diff --git a/js/models/messages.js b/js/models/messages.js index bd9660c7..50be25a0 100644 --- a/js/models/messages.js +++ b/js/models/messages.js @@ -345,10 +345,10 @@ groupId : dataMessage.group.id, name : dataMessage.group.name, avatar : dataMessage.group.avatar, - members : dataMessage.group.members, + members : _.union(dataMessage.group.members, conversation.get('members')), }; group_update = conversation.changedAttributes(_.pick(dataMessage.group, 'name', 'avatar')) || {}; - var difference = _.difference(dataMessage.group.members, conversation.get('members')); + var difference = _.difference(attributes.members, conversation.get('members')); if (difference.length > 0) { group_update.joined = difference; } diff --git a/libtextsecure/storage/groups.js b/libtextsecure/storage/groups.js index 080d421a..0903b68b 100644 --- a/libtextsecure/storage/groups.js +++ b/libtextsecure/storage/groups.js @@ -139,19 +139,9 @@ if (numbers.filter(textsecure.utils.isNumberSane).length < numbers.length) throw new Error("Invalid number in new group members"); - if (group.numbers.filter(function(number) { return numbers.indexOf(number) < 0 }).length > 0) - throw new Error("Attempted to remove numbers from group with an UPDATE"); - var added = numbers.filter(function(number) { return group.numbers.indexOf(number) < 0; }); - return textsecure.storage.groups.addNumbers(groupId, added).then(function(newGroup) { - if (numbers.filter(function(number) { return newGroup.indexOf(number) < 0; }).length != 0 || - newGroup.filter(function(number) { return numbers.indexOf(number) < 0; }).length != 0) { - throw new Error("Error calculating group member difference"); - } - - return added; - }); + return textsecure.storage.groups.addNumbers(groupId, added); }); },