Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix transitioning issue from old dot #28984

Merged
10 changes: 10 additions & 0 deletions src/libs/Navigation/AppNavigator/AuthScreens.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import * as SessionUtils from '../../SessionUtils';
import NotFoundPage from '../../../pages/ErrorPage/NotFoundPage';
import getRootNavigatorScreenOptions from './getRootNavigatorScreenOptions';
import DemoSetupPage from '../../../pages/DemoSetupPage';
import getCurrentUrl from '../currentUrl';

let timezone;
let currentAccountID;
Expand Down Expand Up @@ -145,6 +146,15 @@ class AuthScreens extends React.Component {
}

componentDidMount() {
const currentUrl = getCurrentUrl();
const isLoggingInAsNewUser = SessionUtils.isLoggingInAsNewUser(currentUrl, this.props.session.email);
// Sign out the current user if we're transitioning with a different user
const isTransitioning = currentUrl.includes(ROUTES.TRANSITION_BETWEEN_APPS);
if (isLoggingInAsNewUser && isTransitioning) {
Session.signOutAndRedirectToSignIn();
return;
}

NetworkConnection.listenForReconnect();
NetworkConnection.onReconnect(() => {
if (isLoadingApp) {
Expand Down
3 changes: 0 additions & 3 deletions src/libs/actions/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,6 @@ function setUpPoliciesAndNavigate(session, shouldNavigateToAdminChat) {

// Sign out the current user if we're transitioning with a different user
const isTransitioning = Str.startsWith(url.pathname, Str.normalizeUrl(ROUTES.TRANSITION_BETWEEN_APPS));
if (isLoggingInAsNewUser && isTransitioning) {
Session.signOut();
}

const shouldCreateFreePolicy = !isLoggingInAsNewUser && isTransitioning && exitTo === ROUTES.WORKSPACE_NEW;
if (shouldCreateFreePolicy) {
Expand Down
Loading