From 0fa1069a93d9bb49a9ad886a94e360545f917c7f Mon Sep 17 00:00:00 2001 From: lilia Date: Thu, 1 Oct 2015 20:57:19 -0700 Subject: [PATCH] Don't throw on duplicate members in a group update Fixes #364 // FREEBIE --- js/libtextsecure.js | 2 +- libtextsecure/storage/groups.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/libtextsecure.js b/js/libtextsecure.js index ddf023c56521..bf44b3413a7b 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -38258,7 +38258,7 @@ axolotlInternal.RecipientRecord = function() { var added = numbers.filter(function(number) { return group.numbers.indexOf(number) < 0; }); return textsecure.storage.groups.addNumbers(groupId, added).then(function(newGroup) { - if (newGroup.length != numbers.length || + 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"); } diff --git a/libtextsecure/storage/groups.js b/libtextsecure/storage/groups.js index 90154a0fd57a..959966a93819 100644 --- a/libtextsecure/storage/groups.js +++ b/libtextsecure/storage/groups.js @@ -145,7 +145,7 @@ var added = numbers.filter(function(number) { return group.numbers.indexOf(number) < 0; }); return textsecure.storage.groups.addNumbers(groupId, added).then(function(newGroup) { - if (newGroup.length != numbers.length || + 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"); }