Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: hide studio button for limited staff [BACKPORT][BB-9082] #32

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -55,6 +55,7 @@ const InstructorToolbar = (props) => {
const {
courseId,
unitId,
studioButtonVisible,
tab,
} = props;

Expand All @@ -72,13 +73,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 && studioButtonVisible) || urlInsights) && (
<>
<hr className="border-light" />
<span className="mr-2 mt-1 col-form-label">View course in:</span>
</>
)}
{urlStudio && (
{urlStudio && studioButtonVisible && (
<span className="mx-1 my-1">
<a className="btn btn-inverse-outline-primary" href={urlStudio}>Studio</a>
</span>
Expand Down Expand Up @@ -114,12 +115,14 @@ const InstructorToolbar = (props) => {
InstructorToolbar.propTypes = {
courseId: PropTypes.string,
unitId: PropTypes.string,
studioButtonVisible: PropTypes.bool,
tab: PropTypes.string,
};

InstructorToolbar.defaultProps = {
courseId: undefined,
unitId: undefined,
studioButtonVisible: 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}
studioButtonVisible={hasCourseAuthorAccess}
/>
)}
<StreakModal
Expand Down
Loading