Skip to content

Fix Logout retUrl to all sub-communities #5137

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

Merged
merged 1 commit into from
Oct 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ module.exports = {
BLOCKCHAIN: 'https://blockchain.topcoder-dev.com',
COGNITIVE: 'https://cognitive.topcoder-dev.com',
ZURICH: 'https://community-app.topcoder-dev.com/__community__/zurich',
COMCAST: 'https://community-app.topcoder-dev.com/__community__/comcast',
CS: 'https://community-app.topcoder-dev.com/__community__/cs',
},

/* Dedicated section to group together links to various articles in
Expand Down
2 changes: 2 additions & 0 deletions config/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ module.exports = {
BLOCKCHAIN: 'https://blockchain.topcoder.com',
COGNITIVE: 'https://cognitive.topcoder.com',
ZURICH: 'https://zurich.topcoder.com',
COMCAST: 'https://comcast.topcoder.com',
CS: 'https://cs.topcoder.com',
},
EMAIL_VERIFY_URL: 'http://www.topcoder.com/settings/account/changeEmail',
},
Expand Down
16 changes: 14 additions & 2 deletions src/shared/components/tc-communities/Header/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ import DesktopSubMenu from 'components/TopcoderHeader/desktop/SubMenu';
import React from 'react';
import PT from 'prop-types';
import { Avatar, PrimaryButton, Button } from 'topcoder-react-ui-kit';
import { config, Link, NavLink } from 'topcoder-react-utils';
import {
config,
Link,
NavLink,
isomorphy,
} from 'topcoder-react-utils';
import { getRatingColor } from 'utils/tc';
import Dropdown from 'components/tc-communities/Dropdown';
import { themr } from 'react-css-super-themr';
Expand Down Expand Up @@ -47,10 +52,13 @@ function Header(props) {
onMobileToggleClick,
profile,
theme,
logoutRedirect,
meta,
} = props;

let {
logoutRedirect,
} = props;

const BASE_URL = config.URL.BASE;
const AUTH_URL = config.URL.AUTH;
const normalizedProfile = profile && _.clone(profile);
Expand All @@ -59,6 +67,10 @@ function Header(props) {
meta.competitorsGroupIds,
) : [];

if (_.isEmpty(logoutRedirect) && isomorphy.isClientSide()) {
logoutRedirect = window.location.href;
}

let userSubMenu;
if (profile) {
userSubMenu = {
Expand Down
1 change: 1 addition & 0 deletions src/shared/routes/Communities/Blockchain/Routes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export default function Blockchain({ base, member, meta }) {
baseUrl={base}
hideJoinNow
pageId={match.params.pageId || 'home'}
logoutRedirect={config.URL.COMMUNITIES.BLOCKCHAIN}
/>
<Switch>
<Route
Expand Down
2 changes: 2 additions & 0 deletions src/shared/routes/Communities/CS/Routes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import Settings from 'routes/Settings';
import theme from 'components/tc-communities/communities/cs/theme';
import { ThemeProvider } from 'react-css-super-themr';
import { Route, Switch } from 'react-router-dom';
import { config } from 'topcoder-react-utils';

import Leaderboard from '../Leaderboard';

Expand All @@ -35,6 +36,7 @@ export default function CS({ base, meta }) {
<Header
baseUrl={base}
pageId={match.params.pageId || 'home'}
logoutRedirect={config.URL.COMMUNITIES.CS}
/>
<Switch>
<Route
Expand Down
1 change: 1 addition & 0 deletions src/shared/routes/Communities/Cognitive/Routes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export default function Cognitive({ base, member, meta }) {
<Header
baseUrl={base}
pageId={match.params.pageId || 'home'}
logoutRedirect={config.URL.COMMUNITIES.COGNITIVE}
/>
<Switch>
<Route
Expand Down
2 changes: 2 additions & 0 deletions src/shared/routes/Communities/Comcast/Routes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import theme from 'components/tc-communities/communities/comcast/theme';
import { ThemeProvider } from 'react-css-super-themr';
import { Route, Switch } from 'react-router-dom';
import ContentfulRoute from 'components/Contentful/Route';
import { config } from 'topcoder-react-utils';

export default function CS({ base, meta }) {
return (
Expand All @@ -29,6 +30,7 @@ export default function CS({ base, meta }) {
<Header
baseUrl={base}
pageId={match.params.pageId || 'home'}
logoutRedirect={config.URL.COMMUNITIES.COMCAST}
/>
<Switch>
<Route
Expand Down