From 77f2c4bf970c7abd1ff9ae7356e0d8a7fc2b3fb9 Mon Sep 17 00:00:00 2001 From: Muhammad Faraz Maqsood Date: Wed, 11 Jun 2025 16:56:53 +0500 Subject: [PATCH] fix: hide Email staff to create course link - hide Email staff to create course link when DISABLE_COURSE_CREATION is set to True on backend. - backend link: https://github.com/openedx/edx-platform/blob/0611c7891a4a2c726c5f4e505baf1b50b68bd895/cms/djangoapps/contentstore/views/course.py#L1734C5-L1735C59. - when DISABLE_COURSE_CREATION is set to True, it should not show staff email links. - these links should also be disabled by default fr staff users. --- src/studio-home/home-sidebar/index.jsx | 6 ++++-- src/studio-home/hooks.jsx | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/studio-home/home-sidebar/index.jsx b/src/studio-home/home-sidebar/index.jsx index 671f78d25..6a3d43b24 100644 --- a/src/studio-home/home-sidebar/index.jsx +++ b/src/studio-home/home-sidebar/index.jsx @@ -22,8 +22,10 @@ const HomeSidebar = () => { const { home: aboutHomeLink } = useHelpUrls(['home']); // eslint-disable-next-line max-len - const isShowMailToGetInstruction = courseCreatorStatus === COURSE_CREATOR_STATES.disallowedForThisSite - && !!studioRequestEmail; + const isShowMailToGetInstruction = ![ + COURSE_CREATOR_STATES.disallowedForThisSite, + COURSE_CREATOR_STATES.granted, + ].includes(courseCreatorStatus) && !!studioRequestEmail; const isShowUnrequestedInstruction = courseCreatorStatus === COURSE_CREATOR_STATES.unrequested; const isShowDeniedInstruction = courseCreatorStatus === COURSE_CREATOR_STATES.denied; diff --git a/src/studio-home/hooks.jsx b/src/studio-home/hooks.jsx index d1673aae9..1900dc1ca 100644 --- a/src/studio-home/hooks.jsx +++ b/src/studio-home/hooks.jsx @@ -69,7 +69,10 @@ const useStudioHome = () => { } = studioHomeData; const isShowOrganizationDropdown = optimizationEnabled && courseCreatorStatus === COURSE_CREATOR_STATES.granted; - const isShowEmailStaff = courseCreatorStatus === COURSE_CREATOR_STATES.disallowedForThisSite && !!studioRequestEmail; + const isShowEmailStaff = ![ + COURSE_CREATOR_STATES.disallowedForThisSite, + COURSE_CREATOR_STATES.granted, + ].includes(courseCreatorStatus) && !!studioRequestEmail; const isShowProcessing = allowCourseReruns && rerunCreatorStatus && inProcessCourseActions?.length > 0; const hasAbilityToCreateNewCourse = courseCreatorStatus === COURSE_CREATOR_STATES.granted; const anyQueryIsPending = [deleteNotificationSavingStatus, courseCreatorSavingStatus, savingCreateRerunStatus]