From 0854b1937137687a215eda2d3a9b44f35e38fa16 Mon Sep 17 00:00:00 2001 From: lilia Date: Wed, 16 Nov 2016 22:25:36 +0100 Subject: [PATCH] Revert "Don't load group contacts unnecessarily" This reverts commit 6699571910b6e29d74bf8db29a6cb1cbbc49df78. Not quite ready for primetime. --- js/models/conversations.js | 13 +++++++------ js/views/conversation_view.js | 12 +++++------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/js/models/conversations.js b/js/models/conversations.js index beef40de..aa7c5472 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -41,12 +41,13 @@ this.on('change:avatar', this.updateAvatarUrl); this.on('destroy', this.revokeAvatarUrl); this.on('read', this.onReadMessage); - var members = this.get('members') || []; - members.map(function(number) { - textsecure.storage.protocol.on('keychange:' + m.id, function() { - this.conversation.addKeyChange(m.id); + this.fetchContacts().then(function() { + this.contactCollection.each(function(contact) { + textsecure.storage.protocol.on('keychange:' + contact.id, function() { + this.addKeyChange(contact.id); + }.bind(this)); }.bind(this)); - }); + }.bind(this)); }, addKeyChange: function(id) { @@ -323,7 +324,7 @@ } else { var promises = []; var members = this.get('members') || []; - this.contactCollection.add( + this.contactCollection.reset( members.map(function(number) { var c = ConversationController.create({ id : number, diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js index d29349f2..65825b0e 100644 --- a/js/views/conversation_view.js +++ b/js/views/conversation_view.js @@ -269,14 +269,12 @@ }, messageDetail: function(e, data) { - return this.model.fetchContacts().then(function() { - var view = new Whisper.MessageDetailView({ - model: data.message, - conversation: this.model - }); - this.listenBack(view); - view.render(); + var view = new Whisper.MessageDetailView({ + model: data.message, + conversation: this.model }); + this.listenBack(view); + view.render(); }, listenBack: function(view) {