From 79dc6a5cff5f572fa1422f7cfc9e23ca0140babd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gr=C3=A9goire=20Aubert?= Date: Mon, 11 Jun 2018 13:56:49 +0200 Subject: [PATCH] SONAR-10871 Do not automatically display onboarding tutorial for documentation routes --- .../src/main/js/app/components/GlobalContainer.tsx | 2 +- .../src/main/js/app/components/StartupModal.tsx | 4 +++- .../js/app/components/__tests__/StartupModal-test.tsx | 9 +++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/server/sonar-web/src/main/js/app/components/GlobalContainer.tsx b/server/sonar-web/src/main/js/app/components/GlobalContainer.tsx index e61540bd5a8..c8b7167640e 100644 --- a/server/sonar-web/src/main/js/app/components/GlobalContainer.tsx +++ b/server/sonar-web/src/main/js/app/components/GlobalContainer.tsx @@ -35,7 +35,7 @@ export default function GlobalContainer(props: Props) { return ( {({ suggestions }) => ( - +
diff --git a/server/sonar-web/src/main/js/app/components/StartupModal.tsx b/server/sonar-web/src/main/js/app/components/StartupModal.tsx index 600d8ad5cb8..101279628d1 100644 --- a/server/sonar-web/src/main/js/app/components/StartupModal.tsx +++ b/server/sonar-web/src/main/js/app/components/StartupModal.tsx @@ -42,6 +42,7 @@ interface DispatchProps { } interface OwnProps { + location: { pathname: string }; children?: React.ReactNode; } @@ -120,7 +121,8 @@ export class StartupModal extends React.PureComponent { }; tryAutoOpenOnboarding = () => { - if (this.props.currentUser.showOnboardingTutorial) { + const { currentUser, location } = this.props; + if (currentUser.showOnboardingTutorial && !location.pathname.startsWith('documentation')) { this.setState({ automatic: true }); this.openOnboarding(); } diff --git a/server/sonar-web/src/main/js/app/components/__tests__/StartupModal-test.tsx b/server/sonar-web/src/main/js/app/components/__tests__/StartupModal-test.tsx index 0f8cbe18131..d2d48ee7d51 100644 --- a/server/sonar-web/src/main/js/app/components/__tests__/StartupModal-test.tsx +++ b/server/sonar-web/src/main/js/app/components/__tests__/StartupModal-test.tsx @@ -80,6 +80,14 @@ it('should render only the children', async () => { (get as jest.Mock).mockReturnValueOnce('date'); (differenceInDays as jest.Mock).mockReturnValueOnce(0); await shouldNotHaveModals(getWrapper()); + + await shouldNotHaveModals( + getWrapper({ + canAdmin: false, + currentUser: { ...LOGGED_IN_USER, showOnboardingTutorial: true }, + location: { pathname: 'documentation/index' } + }) + ); }); it('should render license prompt', async () => { @@ -130,6 +138,7 @@ function getWrapper(props = {}) { canAdmin={true} currentEdition={EditionKey.enterprise} currentUser={LOGGED_IN_USER} + location={{ pathname: 'foo/bar' }} skipOnboarding={jest.fn()} {...props}>
-- 2.39.5