From fc7e56264f979e1c66b7cf710bced827d1b38290 Mon Sep 17 00:00:00 2001 From: Michael Krasnov Date: Wed, 9 Oct 2024 13:16:06 -0400 Subject: [PATCH] BACKLOG-23211 Fix repo explorer context action permission (#1316) --- .../actions/openInRepositoryExplorerAction.jsx | 13 ++++++++----- .../e2e/menuActions/openInRepoExplorer.cy.ts | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/javascript/JContent/actions/openInRepositoryExplorerAction.jsx b/src/javascript/JContent/actions/openInRepositoryExplorerAction.jsx index 641ebbca4..9b8d018a4 100644 --- a/src/javascript/JContent/actions/openInRepositoryExplorerAction.jsx +++ b/src/javascript/JContent/actions/openInRepositoryExplorerAction.jsx @@ -4,14 +4,17 @@ import PropTypes from 'prop-types'; export const OpenInRepositoryExplorerActionComponent = ({path, render: Render, loading: Loading, ...others}) => { const res = useNodeChecks({path}, { - showOnNodeTypes: ['nt:base'], + showOnNodeTypes: ['nt:base'] + }); + const rootRes = useNodeChecks({path: '/'}, { requiredPermission: 'repositoryExplorer' }); - if (res.loading && Loading) { + + if ((rootRes.loading || res.loading) && Loading) { return ; } - if (!res.node) { + if (!res.node || !rootRes.node) { return (); } @@ -20,8 +23,8 @@ export const OpenInRepositoryExplorerActionComponent = ({path, render: Render, l return ( { window.open(url); }} diff --git a/tests/cypress/e2e/menuActions/openInRepoExplorer.cy.ts b/tests/cypress/e2e/menuActions/openInRepoExplorer.cy.ts index 66f4be20f..94a3a19d0 100644 --- a/tests/cypress/e2e/menuActions/openInRepoExplorer.cy.ts +++ b/tests/cypress/e2e/menuActions/openInRepoExplorer.cy.ts @@ -4,7 +4,7 @@ import gql from 'graphql-tag'; describe('Open in repo explorer tests', () => { let expectedUrl = null; before(() => { - cy.loginAndStoreSession(); // Edit in chief + cy.loginAndStoreSession('root', 'root1234'); cy.apollo({ query: gql` query {