feat: hide studio button for limited staff (#1436)

This commit is contained in:
Demid
2024-11-28 21:06:05 +02:00
committed by GitHub
parent 90ef6ace5c
commit ead98538b9
3 changed files with 9 additions and 2 deletions

View File

@@ -89,6 +89,7 @@ describe('Course Home Service', () => {
}),
title: string('Demonstration Course'),
username: string('edx'),
has_course_author_access: boolean(true),
},
},
});
@@ -133,6 +134,7 @@ describe('Course Home Service', () => {
],
title: 'Demonstration Course',
username: 'edx',
hasCourseAuthorAccess: true,
};
const response = getCourseHomeCourseMetadata(courseId, 'outline');
expect(response).toBeTruthy();

View File

@@ -57,6 +57,7 @@ const InstructorToolbar = (props) => {
const {
courseId,
unitId,
isStudioButtonVisible,
tab,
} = props;
@@ -74,13 +75,13 @@ const InstructorToolbar = (props) => {
<div className="align-items-center flex-grow-1 d-md-flex mx-1 my-1">
<MasqueradeWidget courseId={courseId} onError={showMasqueradeError} />
</div>
{(urlStudio || urlInsights) && (
{((urlStudio && isStudioButtonVisible) || urlInsights) && (
<>
<hr className="border-light" />
<span className="mr-2 mt-1 col-form-label"><FormattedMessage {...messages.titleViewCourseIn} /></span>
</>
)}
{urlStudio && (
{urlStudio && isStudioButtonVisible && (
<span className="mx-1 my-1">
<a className="btn btn-inverse-outline-primary" href={urlStudio}>{formatMessage(messages.titleStudio)}</a>
</span>
@@ -116,12 +117,14 @@ const InstructorToolbar = (props) => {
InstructorToolbar.propTypes = {
courseId: PropTypes.string,
unitId: PropTypes.string,
isStudioButtonVisible: PropTypes.bool,
tab: PropTypes.string,
};
InstructorToolbar.defaultProps = {
courseId: undefined,
unitId: undefined,
isStudioButtonVisible: true,
tab: '',
};

View File

@@ -29,6 +29,7 @@ const LoadedTabPage = ({
tabs,
title,
verifiedMode,
hasCourseAuthorAccess,
} = useModel('courseHomeMeta', courseId);
// Logistration and enrollment alerts are only really used for the outline tab, but loaded here to put them above
@@ -58,6 +59,7 @@ const LoadedTabPage = ({
courseId={courseId}
unitId={unitId}
tab={activeTabSlug}
isStudioButtonVisible={hasCourseAuthorAccess}
/>
)}
<StreakModal