Revert "Remove unregistered group members"

This reverts commit a768b94471.

d2ddfc7 was enough to fix #989. Removing unregistered members from the
group (as opposed to silently ignorning them) creates greater potential
for getting out of sync with the member lists on other devices.

// FREEBIE
This commit is contained in:
lilia 2017-02-16 14:59:19 -08:00
parent dfe9ee9679
commit e648a4b095
2 changed files with 2 additions and 30 deletions

View file

@ -62,19 +62,6 @@
message.save().then(this.trigger.bind(this,'newmessage', message)); message.save().then(this.trigger.bind(this,'newmessage', message));
}, },
addMemberLeft: function(source) {
var timestamp = Date.now();
var message = new Whisper.Message({
conversationId : this.id,
source : source,
type : 'incoming',
sent_at : timestamp,
received_at : timestamp,
group_update : {left: source}
});
message.save().then(this.trigger.bind(this,'newmessage', message));
},
onReadMessage: function(message) { onReadMessage: function(message) {
if (this.messageCollection.get(message.id)) { if (this.messageCollection.get(message.id)) {
this.messageCollection.get(message.id).fetch(); this.messageCollection.get(message.id).fetch();

View file

@ -201,39 +201,24 @@
this.sendSyncMessage(); this.sendSyncMessage();
}.bind(this)).catch(function(result) { }.bind(this)).catch(function(result) {
var now = Date.now(); var now = Date.now();
var errors;
var conversation = this.getConversation();
this.trigger('done'); this.trigger('done');
if (result.dataMessage) { if (result.dataMessage) {
this.set({dataMessage: result.dataMessage}); this.set({dataMessage: result.dataMessage});
} }
if (result instanceof Error) { if (result instanceof Error) {
errors = [result]; this.saveErrors(result);
this.saveErrors(errors);
if (result.name === 'SignedPreKeyRotationError') { if (result.name === 'SignedPreKeyRotationError') {
getAccountManager().rotateSignedPreKey(); getAccountManager().rotateSignedPreKey();
} }
} else { } else {
errors = result.errors; this.saveErrors(result.errors);
this.saveErrors(errors);
if (result.successfulNumbers.length > 0) { if (result.successfulNumbers.length > 0) {
this.set({sent: true, expirationStartTimestamp: now}); this.set({sent: true, expirationStartTimestamp: now});
this.sendSyncMessage(); 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)); }.bind(this));
}, },