Skip to content

Commit

Permalink
Revert "fix: show studio button if user has access (#1452)" (#1486)
Browse files Browse the repository at this point in the history
This reverts commit 82b27e5.
  • Loading branch information
KristinAoki authored Sep 13, 2024
1 parent d78851b commit 500e4ab
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 21 deletions.
9 changes: 3 additions & 6 deletions src/instructor-toolbar/InstructorToolbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ function getInsightsUrl(courseId) {
return urlFull;
}

function getStudioUrl(courseId, unitId, hasStudioAccess) {
function getStudioUrl(courseId, unitId) {
const urlBase = getConfig().STUDIO_BASE_URL;
let urlFull;
if (urlBase && hasStudioAccess) {
if (urlBase) {
if (unitId) {
urlFull = `${urlBase}/container/${unitId}`;
} else if (courseId) {
Expand Down Expand Up @@ -56,11 +56,10 @@ const InstructorToolbar = (props) => {
courseId,
unitId,
tab,
hasStudioAccess,
} = props;

const urlInsights = getInsightsUrl(courseId);
const urlStudio = getStudioUrl(courseId, unitId, hasStudioAccess);
const urlStudio = getStudioUrl(courseId, unitId);
const [masqueradeErrorMessage, showMasqueradeError] = useState(null);

const accessExpirationMasqueradeBanner = useAccessExpirationMasqueradeBanner(courseId, tab);
Expand Down Expand Up @@ -116,14 +115,12 @@ InstructorToolbar.propTypes = {
courseId: PropTypes.string,
unitId: PropTypes.string,
tab: PropTypes.string,
hasStudioAccess: PropTypes.bool,
};

InstructorToolbar.defaultProps = {
courseId: undefined,
unitId: undefined,
tab: '',
hasStudioAccess: false,
};

export default InstructorToolbar;
13 changes: 0 additions & 13 deletions src/instructor-toolbar/InstructorToolbar.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ describe('Instructor Toolbar', () => {
mockData = {
courseId: courseware.courseId,
unitId: Object.values(models.units)[0].id,
hasStudioAccess: true,
};
axiosMock.reset();
axiosMock.onGet(masqueradeUrl).reply(200, { success: true });
Expand Down Expand Up @@ -77,16 +76,4 @@ describe('Instructor Toolbar', () => {

expect(screen.queryByText('View course in:')).not.toBeInTheDocument();
});

it('does not display Studio link if user does not have studio access', () => {
const config = { ...originalConfig };
const data = { ...mockData, hasStudioAccess: false };
config.INSIGHTS_BASE_URL = 'http://localhost:18100';
getConfig.mockImplementation(() => config);
render(<InstructorToolbar {...data} />);

const linksContainer = screen.getByText('View course in:').parentElement;
expect(screen.queryByText(linksContainer, 'Studio')).toBeNull();
expect(getByText(linksContainer, 'Insights').getAttribute('href')).toMatch(/http.*/);
});
});
2 changes: 0 additions & 2 deletions src/tab-page/LoadedTabPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const LoadedTabPage = ({
celebrations,
org,
originalUserIsStaff,
studioAccess,
tabs,
title,
verifiedMode,
Expand Down Expand Up @@ -59,7 +58,6 @@ const LoadedTabPage = ({
courseId={courseId}
unitId={unitId}
tab={activeTabSlug}
hasStudioAccess={studioAccess}
/>
)}
<StreakModal
Expand Down

0 comments on commit 500e4ab

Please sign in to comment.