Remove unregistered group members

Locally remove unregistered users from group membership lists.

Fixes #989
Related to Whispersystems/Signal-Android#6175
Closes #1052

// FREEBIE
This commit is contained in:
haffenloher 2017-02-06 15:13:04 +01:00 committed by lilia
parent d2ddfc72e4
commit a768b94471
2 changed files with 30 additions and 2 deletions

View file

@ -201,21 +201,36 @@
this.sendSyncMessage();
}.bind(this)).catch(function(result) {
var now = Date.now();
var errors;
var conversation = this.getConversation();
this.trigger('done');
if (result.dataMessage) {
this.set({dataMessage: result.dataMessage});
}
if (result instanceof Error) {
this.saveErrors(result);
errors = [result];
this.saveErrors(errors);
} else {
this.saveErrors(result.errors);
errors = result.errors;
this.saveErrors(errors);
if (result.successfulNumbers.length > 0) {
this.set({sent: true, expirationStartTimestamp: now});
this.sendSyncMessage();
}
}
if (conversation.get('type') === 'group') {
errors.forEach(function(e) {
if (e.name === 'UnregisteredUserError') {
textsecure.storage.groups.removeNumber(conversation.id, e.number);
conversation.addMemberLeft(e.number);
conversation.set({
members: _.without(conversation.get('members'), e.number)
});
}
});
}
}.bind(this));
},