Skip to content

Commit

Permalink
Ensure that we have all conversations in redux store
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnonnenberg-signal authored and Mikunj committed Apr 18, 2019
1 parent 7387e88 commit ef670be
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions js/conversation_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
}))();

window.getInboxCollection = () => inboxCollection;
window.getConversations = () => conversations;

const contactCollection = new (Backbone.Collection.extend({
initialize() {
Expand Down
13 changes: 7 additions & 6 deletions js/views/inbox_view.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* global
extension,
getConversations,
getInboxCollection,
i18n,
Whisper,
Expand Down Expand Up @@ -137,8 +138,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
);

Expand Down Expand Up @@ -180,19 +181,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);
Expand Down

0 comments on commit ef670be

Please sign in to comment.