]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-10871 Do not automatically display onboarding tutorial for documentation routes
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Mon, 11 Jun 2018 11:56:49 +0000 (13:56 +0200)
committerSonarTech <sonartech@sonarsource.com>
Tue, 12 Jun 2018 18:21:04 +0000 (20:21 +0200)
server/sonar-web/src/main/js/app/components/GlobalContainer.tsx
server/sonar-web/src/main/js/app/components/StartupModal.tsx
server/sonar-web/src/main/js/app/components/__tests__/StartupModal-test.tsx

index e61540bd5a8e4814e9cb4cbd893a97bb821e9ee1..c8b7167640e36f551944283d28b359e6eeefbeb2 100644 (file)
@@ -35,7 +35,7 @@ export default function GlobalContainer(props: Props) {
   return (
     <SuggestionsProvider>
       {({ suggestions }) => (
-        <StartupModal>
+        <StartupModal location={props.location}>
           <div className="global-container">
             <div className="page-wrapper" id="container">
               <div className="page-container">
index 600d8ad5cb858f94ff64460dbe693e1dcfc7a949..101279628d142fec7843c4fdc16a1b40e9f7018d 100644 (file)
@@ -42,6 +42,7 @@ interface DispatchProps {
 }
 
 interface OwnProps {
+  location: { pathname: string };
   children?: React.ReactNode;
 }
 
@@ -120,7 +121,8 @@ export class StartupModal extends React.PureComponent<Props, State> {
   };
 
   tryAutoOpenOnboarding = () => {
-    if (this.props.currentUser.showOnboardingTutorial) {
+    const { currentUser, location } = this.props;
+    if (currentUser.showOnboardingTutorial && !location.pathname.startsWith('documentation')) {
       this.setState({ automatic: true });
       this.openOnboarding();
     }
index 0f8cbe181315fb0b6482d3252d5b07e1e17a9eb0..d2d48ee7d51731acff850334aa2106bac0eb39a6 100644 (file)
@@ -80,6 +80,14 @@ it('should render only the children', async () => {
   (get as jest.Mock<any>).mockReturnValueOnce('date');
   (differenceInDays as jest.Mock<any>).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}>
       <div />