Revert "fix: show studio button if user has access (#1452)" (#1486)

This reverts commit 82b27e59cc.
This commit is contained in:
Kristin Aoki
2024-09-13 13:39:10 -04:00
committed by GitHub
parent d78851bb5b
commit 500e4abcb9
3 changed files with 3 additions and 21 deletions

View File

@@ -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) {
@@ -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);
@@ -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;

View File

@@ -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 });
@@ -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.*/);
});
});

View File

@@ -26,7 +26,6 @@ const LoadedTabPage = ({
celebrations,
org,
originalUserIsStaff,
studioAccess,
tabs,
title,
verifiedMode,
@@ -59,7 +58,6 @@ const LoadedTabPage = ({
courseId={courseId}
unitId={unitId}
tab={activeTabSlug}
hasStudioAccess={studioAccess}
/>
)}
<StreakModal