]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-10978 hide security reports for short branches and pull requests (#518)
authorStas Vilchik <stas.vilchik@sonarsource.com>
Wed, 18 Jul 2018 07:11:40 +0000 (09:11 +0200)
committerSonarTech <sonartech@sonarsource.com>
Wed, 18 Jul 2018 18:21:20 +0000 (20:21 +0200)
server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx
server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavMenu-test.tsx.snap

index 45c15f90b35786b2f77bf60b2a9694ff4c5a60e0..1accbd77863a44e3ae37c6c23115256735dd4acb 100644 (file)
@@ -191,9 +191,16 @@ export default class ComponentNavMenu extends React.PureComponent<Props> {
   }
 
   renderSecurityReports() {
-    if (this.props.component.qualifier === 'BRC' || this.props.component.qualifier === 'DIR') {
+    const { branchLike, component } = this.props;
+
+    if (component.qualifier === 'BRC' || component.qualifier === 'DIR') {
+      return null;
+    }
+
+    if (isShortLivingBranch(branchLike) || isPullRequest(branchLike)) {
       return null;
     }
+
     const isActive = location.pathname.startsWith('/project/security_reports');
     return (
       <Dropdown overlay={this.renderSecurityReportsLink()} tagName="li">
index d35a9a9e59effc17ceec2e12911cad08a9c029c7..0b2bf02dab9b3c731cf71b422fed5a2e2a165991 100644 (file)
@@ -1097,51 +1097,6 @@ exports[`should work for short-living branches 1`] = `
       issues.page
     </Link>
   </li>
-  <Dropdown
-    overlay={
-      <ul
-        className="menu"
-      >
-        <li>
-          <Link
-            activeClassName="active"
-            onlyActiveOnIndex={false}
-            style={Object {}}
-            to={
-              Object {
-                "pathname": "/project/security_reports/owasp_top_10",
-                "query": Object {
-                  "branch": "feature",
-                  "id": "foo",
-                },
-              }
-            }
-          >
-            security_reports.owaspTop10.page
-          </Link>
-        </li>
-        <li>
-          <Link
-            activeClassName="active"
-            onlyActiveOnIndex={false}
-            style={Object {}}
-            to={
-              Object {
-                "pathname": "/project/security_reports/sans_top_25",
-                "query": Object {
-                  "branch": "feature",
-                  "id": "foo",
-                },
-              }
-            }
-          >
-            security_reports.sansTop25.page
-          </Link>
-        </li>
-      </ul>
-    }
-    tagName="li"
-  />
   <li>
     <Link
       activeClassName="active"