Reject messages sent to groups with no members

If you're the last member of the group, it doesn't make sense to send
messages to it. Previously, we would wait forever for a callback,
causing a stuck pending state indicator.

// FREEBIE
This commit is contained in:
lilia 2015-11-06 18:51:18 -08:00
parent 4136e3633c
commit a3d29a92bb
2 changed files with 6 additions and 0 deletions

View file

@ -40000,6 +40000,9 @@ MessageSender.prototype = {
timestamp = timestamp || Date.now();
var me = textsecure.storage.user.getNumber();
numbers = numbers.filter(function(number) { return number != me; });
if (numbers.length === 0) {
return Promise.reject(new Error('No other members in the group'));
}
return new Promise(function(resolve, reject) {
this.sendMessageProto(timestamp, numbers, proto, function(res) {

View file

@ -148,6 +148,9 @@ MessageSender.prototype = {
timestamp = timestamp || Date.now();
var me = textsecure.storage.user.getNumber();
numbers = numbers.filter(function(number) { return number != me; });
if (numbers.length === 0) {
return Promise.reject(new Error('No other members in the group'));
}
return new Promise(function(resolve, reject) {
this.sendMessageProto(timestamp, numbers, proto, function(res) {