Skip to content

Commit

Permalink
feat: hide studio button for limited staff (#1436)
Browse files Browse the repository at this point in the history
  • Loading branch information
0x29a authored Nov 28, 2024
1 parent 90ef6ac commit ead9853
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/course-home/data/pact-tests/lmsPact.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ describe('Course Home Service', () => {
}),
title: string('Demonstration Course'),
username: string('edx'),
has_course_author_access: boolean(true),
},
},
});
Expand Down Expand Up @@ -133,6 +134,7 @@ describe('Course Home Service', () => {
],
title: 'Demonstration Course',
username: 'edx',
hasCourseAuthorAccess: true,
};
const response = getCourseHomeCourseMetadata(courseId, 'outline');
expect(response).toBeTruthy();
Expand Down
7 changes: 5 additions & 2 deletions src/instructor-toolbar/InstructorToolbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const InstructorToolbar = (props) => {
const {
courseId,
unitId,
isStudioButtonVisible,
tab,
} = props;

Expand All @@ -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>
Expand Down Expand Up @@ -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: '',
};

Expand Down
2 changes: 2 additions & 0 deletions src/tab-page/LoadedTabPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -58,6 +59,7 @@ const LoadedTabPage = ({
courseId={courseId}
unitId={unitId}
tab={activeTabSlug}
isStudioButtonVisible={hasCourseAuthorAccess}
/>
)}
<StreakModal
Expand Down

0 comments on commit ead9853

Please sign in to comment.