From c22e93ddb0306c60e0de0a3c7df8a0ed13bb2cb3 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Fri, 9 Apr 2021 20:26:10 -0400 Subject: [PATCH] Fix logout by preventing the app from showing ErrorTeamsList screen (#5301) --- app/screens/channel/channel_base.js | 3 ++- app/screens/channel/index.js | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/screens/channel/channel_base.js b/app/screens/channel/channel_base.js index 96e71390a..79b3e0070 100644 --- a/app/screens/channel/channel_base.js +++ b/app/screens/channel/channel_base.js @@ -36,6 +36,7 @@ export default class ChannelBase extends PureComponent { componentId: PropTypes.string.isRequired, currentChannelId: PropTypes.string, currentTeamId: PropTypes.string, + currentUserId: PropTypes.string, disableTermsModal: PropTypes.bool, isSupportedServer: PropTypes.bool, isSystemAdmin: PropTypes.bool, @@ -132,7 +133,7 @@ export default class ChannelBase extends PureComponent { }); } - if (prevProps.currentTeamId && !this.props.currentTeamId) { + if (this.props.currentUserId && prevProps.currentTeamId && !this.props.currentTeamId) { this.props.actions.selectDefaultTeam(); } diff --git a/app/screens/channel/index.js b/app/screens/channel/index.js index e6ba1c191..5701f7e80 100644 --- a/app/screens/channel/index.js +++ b/app/screens/channel/index.js @@ -22,6 +22,7 @@ import Channel from './channel'; function mapStateToProps(state) { const currentTeam = getCurrentTeam(state); + const currentUserId = getCurrentUserId(state); const roles = getCurrentUserId(state) ? getCurrentUserRoles(state) : ''; const isSystemAdmin = checkIsSystemAdmin(roles); const serverVersion = Client4.getServerVersion() || getServerVersion(state); @@ -42,6 +43,7 @@ function mapStateToProps(state) { return { currentChannelId, currentTeamId, + currentUserId, isSupportedServer, isSystemAdmin, showTermsOfService: shouldShowTermsOfService(state),