From feb6d5a39ac3065e82827bc1c60f59da91860e08 Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Wed, 3 Mar 2021 09:29:36 +1100 Subject: [PATCH] register allconvos on ActionPanel start --- ts/components/session/ActionsPanel.tsx | 6 +++++- ts/session/conversations/index.ts | 18 ++++++------------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/ts/components/session/ActionsPanel.tsx b/ts/components/session/ActionsPanel.tsx index ba54fe1c1..e583bb8da 100644 --- a/ts/components/session/ActionsPanel.tsx +++ b/ts/components/session/ActionsPanel.tsx @@ -44,6 +44,10 @@ interface Props { theme: DefaultTheme; } +/** + * ActionsPanel is the far left banner (not the left pane). + * The panel with buttons to switch between the message/contact/settings/theme views + */ class ActionsPanelPrivate extends React.Component { private syncInterval: NodeJS.Timeout | null = null; @@ -71,7 +75,7 @@ class ActionsPanelPrivate extends React.Component { // If that's the case, the save events on our conversation won't be triggering redux updates. // So changes to our conversation won't make a change on the UI. // Calling this makes sure that our own conversation is registered to redux. - ConversationController.getInstance().registerOurPrimaryConvoOnRedux(); + ConversationController.getInstance().registerAllConvosToRedux(); // init the messageQueue. In the constructor, we had all not send messages // this call does nothing except calling the constructor, which will continue sending message in the pipeline diff --git a/ts/session/conversations/index.ts b/ts/session/conversations/index.ts index bd924d947..bb6da853b 100644 --- a/ts/session/conversations/index.ts +++ b/ts/session/conversations/index.ts @@ -316,19 +316,13 @@ export class ConversationController { this.conversations.reset([]); } - public registerOurPrimaryConvoOnRedux() { + public registerAllConvosToRedux() { if (window.inboxStore) { - const ourPubkey = UserUtils.getOurPubKeyStrFromCache(); - const ourConversation = this.conversations.get(ourPubkey); - if (!ourConversation) { - window.log.warn( - 'Cannot register ourPrimary convo to redux, our convo does not exist' - ); - return; - } - // make sure our conversation is registered to forward it's commit events to redux - ourConversation.off('change', this.updateReduxConvoChanged); - ourConversation.on('change', this.updateReduxConvoChanged); + this.conversations.forEach((convo: ConversationModel) => { + // make sure all conversations are registered to forward their commit events to redux + convo.off('change', this.updateReduxConvoChanged); + convo.on('change', this.updateReduxConvoChanged); + }); } }