From e648a4b0956c4dc31655ae9db117476845ddd0e2 Mon Sep 17 00:00:00 2001 From: lilia Date: Thu, 16 Feb 2017 14:59:19 -0800 Subject: [PATCH] Revert "Remove unregistered group members" This reverts commit a768b944718caaad55d46884b2b54ca2102b55de. 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 --- js/models/conversations.js | 13 ------------- js/models/messages.js | 19 ++----------------- 2 files changed, 2 insertions(+), 30 deletions(-) diff --git a/js/models/conversations.js b/js/models/conversations.js index e8cc0247807..519dcbf7bd9 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -62,19 +62,6 @@ 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) { if (this.messageCollection.get(message.id)) { this.messageCollection.get(message.id).fetch(); diff --git a/js/models/messages.js b/js/models/messages.js index 58514110af0..7dc939e45e3 100644 --- a/js/models/messages.js +++ b/js/models/messages.js @@ -201,39 +201,24 @@ 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) { - errors = [result]; - this.saveErrors(errors); + this.saveErrors(result); if (result.name === 'SignedPreKeyRotationError') { getAccountManager().rotateSignedPreKey(); } } else { - errors = result.errors; - this.saveErrors(errors); + this.saveErrors(result.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)); },