Skip to content

Commit ee88a12

Browse files
committed
fix: assume that dates & outline legacy tabs don't exist
They've both been removed from the LMS now. It would be harmless to keep support for them in place, but it's pointless because any redirects to the LMS will just come right back to us. AA-799
1 parent 9b316bd commit ee88a12

7 files changed

Lines changed: 11 additions & 35 deletions

File tree

src/course-home/data/api.js

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,6 @@ export async function getDatesTabData(courseId) {
208208
return camelCaseObject(data);
209209
} catch (error) {
210210
const { httpErrorStatus } = error && error.customAttributes;
211-
if (httpErrorStatus === 404) {
212-
global.location.replace(`${getConfig().LMS_BASE_URL}/courses/${courseId}/dates`);
213-
return {};
214-
}
215211
if (httpErrorStatus === 401) {
216212
// The backend sends this for unenrolled and unauthenticated learners, but we handle those cases by examining
217213
// courseAccess in the metadata call, so just ignore this status for now.
@@ -328,21 +324,9 @@ export function getTimeOffsetMillis(headerDate, requestTime, responseTime) {
328324

329325
export async function getOutlineTabData(courseId) {
330326
const url = `${getConfig().LMS_BASE_URL}/api/course_home/outline/${courseId}`;
331-
let { tabData } = {};
332-
let requestTime = Date.now();
333-
let responseTime = requestTime;
334-
try {
335-
requestTime = Date.now();
336-
tabData = await getAuthenticatedHttpClient().get(url);
337-
responseTime = Date.now();
338-
} catch (error) {
339-
const { httpErrorStatus } = error && error.customAttributes;
340-
if (httpErrorStatus === 404) {
341-
global.location.replace(`${getConfig().LMS_BASE_URL}/courses/${courseId}/course/`);
342-
return {};
343-
}
344-
throw error;
345-
}
327+
const requestTime = Date.now();
328+
const tabData = await getAuthenticatedHttpClient().get(url);
329+
const responseTime = Date.now();
346330

347331
const {
348332
data,

src/course-home/dates-tab/DatesTab.test.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,12 +341,12 @@ describe('DatesTab', () => {
341341

342342
it('redirects to the home page when unauthenticated', async () => {
343343
await renderDenied('authentication_required');
344-
expect(global.location.href).toEqual(`http://localhost/redirect/course-home/${courseMetadata.id}`);
344+
expect(global.location.href).toEqual(`http://localhost/course/${courseMetadata.id}/home`);
345345
});
346346

347347
it('redirects to the home page when unenrolled', async () => {
348348
await renderDenied('enrollment_required');
349-
expect(global.location.href).toEqual(`http://localhost/redirect/course-home/${courseMetadata.id}`);
349+
expect(global.location.href).toEqual(`http://localhost/course/${courseMetadata.id}/home`);
350350
});
351351
});
352352
});

src/course-home/progress-tab/grades/detailed-grades/DetailedGrades.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from 'react';
22
import { useSelector } from 'react-redux';
33

4-
import { getConfig } from '@edx/frontend-platform';
54
import { sendTrackEvent } from '@edx/frontend-platform/analytics';
65
import { getAuthenticatedUser } from '@edx/frontend-platform/auth';
76
import { FormattedMessage, injectIntl, intlShape } from '@edx/frontend-platform/i18n';
@@ -41,7 +40,7 @@ function DetailedGrades({ intl }) {
4140
<Hyperlink
4241
variant="muted"
4342
isInline
44-
destination={`${getConfig().LMS_BASE_URL}/courses/${courseId}/course`}
43+
destination={`/course/${courseId}/home`}
4544
onClick={logOutlineLinkClick}
4645
tabIndex={gradesFeatureIsFullyLocked ? '-1' : '0'}
4746
>

src/course-home/progress-tab/related-links/RelatedLinks.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from 'react';
22
import { useSelector } from 'react-redux';
33

4-
import { getConfig } from '@edx/frontend-platform';
54
import { sendTrackEvent } from '@edx/frontend-platform/analytics';
65
import { getAuthenticatedUser } from '@edx/frontend-platform/auth';
76
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
@@ -33,13 +32,13 @@ function RelatedLinks({ intl }) {
3332
<h3 className="h4">{intl.formatMessage(messages.relatedLinks)}</h3>
3433
<ul className="pl-4">
3534
<li>
36-
<Hyperlink destination={`${getConfig().LMS_BASE_URL}/courses/${courseId}/dates`} onClick={() => logLinkClicked('dates')}>
35+
<Hyperlink destination={`/course/${courseId}/dates`} onClick={() => logLinkClicked('dates')}>
3736
{intl.formatMessage(messages.datesCardLink)}
3837
</Hyperlink>
3938
<p>{intl.formatMessage(messages.datesCardDescription)}</p>
4039
</li>
4140
<li>
42-
<Hyperlink destination={`${getConfig().LMS_BASE_URL}/courses/${courseId}/course`} onClick={() => logLinkClicked('course_outline')}>
41+
<Hyperlink destination={`/course/${courseId}/home`} onClick={() => logLinkClicked('course_outline')}>
4342
{intl.formatMessage(messages.outlineCardLink)}
4443
</Hyperlink>
4544
<p>{intl.formatMessage(messages.outlineCardDescription)}</p>

src/courseware/CoursewareContainer.test.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ describe('CoursewareContainer', () => {
465465
const { courseMetadata } = setUpWithDeniedStatus('enrollment_required');
466466
await loadContainer();
467467

468-
expect(global.location.href).toEqual(`http://localhost/redirect/course-home/${courseMetadata.id}`);
468+
expect(global.location.href).toEqual(`http://localhost/course/${courseMetadata.id}/home`);
469469
});
470470

471471
it('should go to course survey for a survey_required error code', async () => {
@@ -479,7 +479,7 @@ describe('CoursewareContainer', () => {
479479
const { courseMetadata } = setUpWithDeniedStatus('authentication_required');
480480
await loadContainer();
481481

482-
expect(global.location.href).toEqual(`http://localhost/redirect/course-home/${courseMetadata.id}`);
482+
expect(global.location.href).toEqual(`http://localhost/course/${courseMetadata.id}/home`);
483483
});
484484

485485
it('should go to dashboard for an unfulfilled_milestones error code', async () => {

src/courseware/CoursewareRedirectLandingPage.jsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ export default () => {
2626
global.location.assign(`${getConfig().LMS_BASE_URL}/courses/${match.params.courseId}/jump_to/${match.params.unitId}?experience=legacy`);
2727
}}
2828
/>
29-
<PageRoute
30-
path={`${path}/course-home/:courseId`}
31-
render={({ match }) => {
32-
global.location.assign(`${getConfig().LMS_BASE_URL}/courses/${match.params.courseId}/course/`);
33-
}}
34-
/>
3529
<PageRoute
3630
path={`${path}/survey/:courseId`}
3731
render={({ match }) => {

src/shared/access.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function getAccessDeniedRedirectUrl(courseId, activeTabSlug, canLoadCours
2929
if (activeTabSlug === 'courseware' && canLoadCourseware === false && unitId) {
3030
url = `/redirect/courseware/${courseId}/unit/${unitId}`;
3131
} else if (activeTabSlug !== 'outline') {
32-
url = `/redirect/course-home/${courseId}`;
32+
url = `/course/${courseId}/home`;
3333
}
3434
}
3535
return url;

0 commit comments

Comments
 (0)