Skip to content

Commit

Permalink
refactor!: clean up unused references to lms_web_url (openedx#409)
Browse files Browse the repository at this point in the history
Before edx-platform version 19ba691,
only `lms_web_url` was exposed from the course
blocks API. Now that the API also exposes
`legacy_web_url`, we can stop falling back
to `lms_web_url` when `legacy_web_url` is
absent.

TNL-7796
  • Loading branch information
kdmccormick authored Apr 9, 2021
1 parent e86f4a8 commit 88005ea
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 19 deletions.
7 changes: 3 additions & 4 deletions src/course-home/data/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,12 @@ export function normalizeOutlineBlocks(courseId, blocks) {
effortTime: block.effort_time,
icon: block.icon,
id: block.id,
// Fall back to `lms_web_url` until `legacy_web_url` is added to API (TNL-7796).
legacyWebUrl: block.legacy_web_url || block.lms_web_url,
// The presence of an LMS URL for the sequence indicates that we want this
legacyWebUrl: block.legacy_web_url,
// The presence of an legacy URL for the sequence indicates that we want this
// sequence to be a clickable link in the outline (even though, if the new
// courseware experience is active, we will ignore `legacyWebUrl` and build a
// link to the MFE ourselves).
showLink: !!(block.legacy_web_url || block.lms_web_url),
showLink: !!block.legacy_web_url,
title: block.display_name,
};
break;
Expand Down
6 changes: 2 additions & 4 deletions src/courseware/data/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ export function normalizeBlocks(courseId, blocks) {
effortTime: block.effort_time,
id: block.id,
title: block.display_name,
// Fall back to `lms_web_url` until `legacy_web_url` is added to API (TNL-7796).
legacyWebUrl: block.legacy_web_url || block.lms_web_url,
legacyWebUrl: block.legacy_web_url,
unitIds: block.children || [],
};
break;
Expand All @@ -48,8 +47,7 @@ export function normalizeBlocks(courseId, blocks) {
graded: block.graded,
id: block.id,
title: block.display_name,
// Fall back to `lms_web_url` until `legacy_web_url` is added to API (TNL-7796).
legacyWebUrl: block.legacy_web_url || block.lms_web_url,
legacyWebUrl: block.legacy_web_url,
};
break;
default:
Expand Down
11 changes: 0 additions & 11 deletions src/shared/data/__factories__/block.factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,6 @@ Factory.define('block')
return `${host}/xblock/${id}`;
},
)
.attr(
'lms_web_url',
['legacy_web_url', 'host', 'courseId', 'id'],
(url, host, courseId, id) => {
if (url) {
return url;
}

return `${host}/courses/${courseId}/jump_to/${id}`;
},
)
.attr(
'legacy_web_url',
['legacy_web_url', 'host', 'courseId', 'id'],
Expand Down

0 comments on commit 88005ea

Please sign in to comment.