Switch to isNumberSane in group storage
This commit is contained in:
parent
17782660e2
commit
13d403b334
1 changed files with 6 additions and 8 deletions
|
@ -35,7 +35,9 @@
|
||||||
var haveMe = false;
|
var haveMe = false;
|
||||||
var finalNumbers = [];
|
var finalNumbers = [];
|
||||||
for (var i in numbers) {
|
for (var i in numbers) {
|
||||||
var number = libphonenumber.util.verifyNumber(numbers[i]);
|
var number = numbers[i];
|
||||||
|
if (!textsecure.utils.isNumberSane(number))
|
||||||
|
throw new Error("Invalid number in group");
|
||||||
if (number == me)
|
if (number == me)
|
||||||
haveMe = true;
|
haveMe = true;
|
||||||
if (finalNumbers.indexOf(number) < 0)
|
if (finalNumbers.indexOf(number) < 0)
|
||||||
|
@ -67,12 +69,6 @@
|
||||||
if (group === undefined)
|
if (group === undefined)
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|
||||||
try {
|
|
||||||
number = libphonenumber.util.verifyNumber(number);
|
|
||||||
} catch (e) {
|
|
||||||
return group.numbers;
|
|
||||||
}
|
|
||||||
|
|
||||||
var me = textsecure.utils.unencodeNumber(textsecure.storage.getUnencrypted("number_id"))[0];
|
var me = textsecure.utils.unencodeNumber(textsecure.storage.getUnencrypted("number_id"))[0];
|
||||||
if (number == me)
|
if (number == me)
|
||||||
throw new Error("Cannot remove ourselves from a group, leave the group instead");
|
throw new Error("Cannot remove ourselves from a group, leave the group instead");
|
||||||
|
@ -93,7 +89,9 @@
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|
||||||
for (var i in numbers) {
|
for (var i in numbers) {
|
||||||
var number = libphonenumber.util.verifyNumber(numbers[i]);
|
var number = numbers[i];
|
||||||
|
if (!textsecure.utils.isNumberSane(number))
|
||||||
|
throw new Error("Invalid number in set to add to group");
|
||||||
if (group.numbers.indexOf(number) < 0) {
|
if (group.numbers.indexOf(number) < 0) {
|
||||||
group.numbers.push(number);
|
group.numbers.push(number);
|
||||||
group.numberRegistrationIds[number] = {};
|
group.numberRegistrationIds[number] = {};
|
||||||
|
|
Loading…
Reference in a new issue