diff --git a/js/conversation_controller.js b/js/conversation_controller.js index edb6b69a4..33299beae 100644 --- a/js/conversation_controller.js +++ b/js/conversation_controller.js @@ -116,8 +116,11 @@ }); }, getAllGroupsInvolvingId: function(id) { - return conversations.filter(function(conversation) { - return !conversation.isPrivate() && conversation.hasMember(id); + var groups = new Whisper.GroupCollection(); + return groups.fetchGroups(id).then(function() { + return groups.map(function(group) { + return conversations.add(group); + }); }); }, updateInbox: function() { diff --git a/js/keychange_listener.js b/js/keychange_listener.js index b58272f72..b9b550f7c 100644 --- a/js/keychange_listener.js +++ b/js/keychange_listener.js @@ -17,11 +17,9 @@ conversation.fetch().then(function() { conversation.addKeyChange(id); }); - var groups = new Whisper.GroupCollection(); - return groups.fetchGroups(id).then(function() { - groups.each(function(conversation) { - conversation = ConversationController.add(conversation); - conversation.addKeyChange(id); + ConversationController.getAllGroupsInvolvingId(id).then(function(groups) { + _.forEach(groups, function(group) { + group.addKeyChange(id); }); }); }); diff --git a/js/models/conversations.js b/js/models/conversations.js index ef148fe01..da6925dfc 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -320,9 +320,10 @@ message.save().then(this.trigger.bind(this,'newmessage', message)); if (this.isPrivate()) { - var groups = ConversationController.getAllGroupsInvolvingId(id); - _.forEach(groups, function(group) { - group.addVerifiedChange(id, verified, options); + ConversationController.getAllGroupsInvolvingId(id).then(function(groups) { + _.forEach(groups, function(group) { + group.addVerifiedChange(id, verified, options); + }); }); } },