From 7eb499abda39a99b0892139293f422c4e71cf6d8 Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Thu, 2 Apr 2020 23:03:28 -0400 Subject: [PATCH] chat-js: transition to new chat upon chatSynced changing in join or new chat screen --- pkg/interface/chat/src/js/components/join.js | 3 ++- pkg/interface/chat/src/js/components/root.js | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/interface/chat/src/js/components/join.js b/pkg/interface/chat/src/js/components/join.js index e67d529fad..2f864a9ae5 100644 --- a/pkg/interface/chat/src/js/components/join.js +++ b/pkg/interface/chat/src/js/components/join.js @@ -46,7 +46,8 @@ export class JoinScreen extends Component { componentDidUpdate(prevProps, prevState) { const { props, state } = this; - if (state.station in props.inbox) { + if (state.station in props.inbox || + props.chatSynced !== prevProps.chatSynced) { props.history.push(`/~chat/room${state.station}`); } } diff --git a/pkg/interface/chat/src/js/components/root.js b/pkg/interface/chat/src/js/components/root.js index 43b212f447..62b2aa0994 100644 --- a/pkg/interface/chat/src/js/components/root.js +++ b/pkg/interface/chat/src/js/components/root.js @@ -110,6 +110,7 @@ export class Root extends Component { permissions={state.permissions || {}} contacts={state.contacts || {}} associations={associations.contacts} + chatSynced={state.chatSynced || {}} {...props} /> @@ -139,6 +140,7 @@ export class Root extends Component { api={api} inbox={state.inbox} autoJoin={station} + chatSynced={state.chatSynced || {}} {...props} /> );