fix: remove support for the legacy courseware pages

Access to learners for these pages has been removed, so we don't
need to keep any support for it around. Simplifies some code paths.
This commit is contained in:
Michael Terry
2022-04-19 09:12:40 -04:00
committed by Michael Terry
parent 5461c08169
commit bbff8e719e
18 changed files with 14 additions and 144 deletions

View File

@@ -4,7 +4,7 @@ import { getLocale } from '@edx/frontend-platform/i18n';
// This function inspects an access denied error and provides a redirect url (looks like a /redirect/... path),
// which then renders a nice little message while the browser loads the next page.
// This is basically a frontend version of check_course_access_with_redirect in the backend.
export function getAccessDeniedRedirectUrl(courseId, activeTabSlug, canLoadCourseware, courseAccess, start, unitId) {
export function getAccessDeniedRedirectUrl(courseId, activeTabSlug, courseAccess, start) {
let url = null;
switch (courseAccess.errorCode) {
case 'audit_expired':
@@ -24,11 +24,7 @@ export function getAccessDeniedRedirectUrl(courseId, activeTabSlug, canLoadCours
case 'authentication_required':
case 'enrollment_required':
default:
// if the learner has access to the course, but it is not enabled in the mfe, there is no
// error message, canLoadCourseware will be false.
if (activeTabSlug === 'courseware' && canLoadCourseware === false && unitId) {
url = `/redirect/courseware/${courseId}/unit/${unitId}`;
} else if (activeTabSlug !== 'outline') {
if (activeTabSlug !== 'outline') {
url = `/course/${courseId}/home`;
}
}

View File

@@ -47,13 +47,13 @@ Factory.define('block')
},
)
.attr(
'legacy_web_url',
['legacy_web_url', 'host', 'courseId', 'id'],
'lms_web_url',
['lms_web_url', 'host', 'courseId', 'id'],
(url, host, courseId, id) => {
if (url) {
return url;
}
return `${host}/courses/${courseId}/jump_to/${id}?experience=legacy`;
return `${host}/courses/${courseId}/jump_to/${id}`;
},
);