From 0c69d725c354543f07c1b48dd2ba82f20368db3d Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Mon, 25 Mar 2019 10:22:33 -0700 Subject: [PATCH] Ensure that we have all conversations in redux store --- js/conversation_controller.js | 1 + js/views/inbox_view.js | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/js/conversation_controller.js b/js/conversation_controller.js index 6f0c8f1a1..a13eae124 100644 --- a/js/conversation_controller.js +++ b/js/conversation_controller.js @@ -55,6 +55,7 @@ }))(); window.getInboxCollection = () => inboxCollection; + window.getConversations = () => conversations; window.ConversationController = { get(id) { diff --git a/js/views/inbox_view.js b/js/views/inbox_view.js index 0370e156b..eaea8cbb5 100644 --- a/js/views/inbox_view.js +++ b/js/views/inbox_view.js @@ -1,6 +1,7 @@ /* global ConversationController, extension, + getConversations, getInboxCollection, i18n, Whisper, @@ -104,8 +105,8 @@ }, setupLeftPane() { // Here we set up a full redux store with initial state for our LeftPane Root - const inboxCollection = getInboxCollection(); - const conversations = inboxCollection.map( + const convoCollection = getConversations(); + const conversations = convoCollection.map( conversation => conversation.cachedProps ); const initialState = { @@ -145,19 +146,19 @@ this.openConversationAction = openConversationExternal; - this.listenTo(inboxCollection, 'remove', conversation => { + this.listenTo(convoCollection, 'remove', conversation => { const { id } = conversation || {}; conversationRemoved(id); }); - this.listenTo(inboxCollection, 'add', conversation => { + this.listenTo(convoCollection, 'add', conversation => { const { id, cachedProps } = conversation || {}; conversationAdded(id, cachedProps); }); - this.listenTo(inboxCollection, 'change', conversation => { + this.listenTo(convoCollection, 'change', conversation => { const { id, cachedProps } = conversation || {}; conversationChanged(id, cachedProps); }); - this.listenTo(inboxCollection, 'reset', removeAllConversations); + this.listenTo(convoCollection, 'reset', removeAllConversations); Whisper.events.on('messageExpired', messageExpired); Whisper.events.on('userChanged', userChanged);