From 7b6e89a41e2fc0f5e1bab45016dba96e36363cac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B4mulo=20Penido?= Date: Wed, 4 Dec 2024 12:10:09 -0300 Subject: [PATCH] fix: content libraries permission --- src/studio-home/StudioHome.tsx | 4 ++-- src/studio-home/__mocks__/studioHomeMock.js | 1 + src/studio-home/factories/mockApiResponses.jsx | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/studio-home/StudioHome.tsx b/src/studio-home/StudioHome.tsx index aff75fc6bb..9b8bc20a32 100644 --- a/src/studio-home/StudioHome.tsx +++ b/src/studio-home/StudioHome.tsx @@ -57,6 +57,7 @@ const StudioHome = () => { studioShortName, studioRequestEmail, showNewLibraryButton, + showNewLibraryV2Button, } = studioHomeData; const getHeaderButtons = useCallback(() => { @@ -86,7 +87,7 @@ const StudioHome = () => { ); } - if (showNewLibraryButton || showV2LibraryURL) { + if ((showNewLibraryButton && !showV2LibraryURL) || (showV2LibraryURL && showNewLibraryV2Button)) { const newLibraryClick = () => { if (showV2LibraryURL) { navigate('/library/create'); @@ -101,7 +102,6 @@ const StudioHome = () => { variant="outline-primary" iconBefore={AddIcon} size="sm" - disabled={showNewCourseContainer} onClick={newLibraryClick} data-testid="new-library-button" > diff --git a/src/studio-home/__mocks__/studioHomeMock.js b/src/studio-home/__mocks__/studioHomeMock.js index b9aedf3549..dcd313c511 100644 --- a/src/studio-home/__mocks__/studioHomeMock.js +++ b/src/studio-home/__mocks__/studioHomeMock.js @@ -67,6 +67,7 @@ module.exports = { requestCourseCreatorUrl: '/request_course_creator', rerunCreatorStatus: true, showNewLibraryButton: true, + showNewLibraryV2Button: true, splitStudioHome: false, studioName: 'Studio', studioShortName: 'Studio', diff --git a/src/studio-home/factories/mockApiResponses.jsx b/src/studio-home/factories/mockApiResponses.jsx index 8d86e22d4a..4f9ee03eda 100644 --- a/src/studio-home/factories/mockApiResponses.jsx +++ b/src/studio-home/factories/mockApiResponses.jsx @@ -37,6 +37,7 @@ export const generateGetStudioHomeDataApiResponse = () => ({ requestCourseCreatorUrl: '/request_course_creator', rerunCreatorStatus: true, showNewLibraryButton: true, + showNewLibraryV2Button: true, splitStudioHome: false, studioName: 'Studio', studioShortName: 'Studio',