feat: Use legacy_web_url to redirect to legacy courseware (#404)

As part of making the new courseware experience the
default for staff, the LMS /jump_to/ links that are
exposed by the Course Blocks API via the `lms_web_url`
field will soon direct users to whichever experience
is active to them (instead of always directing to
the legacy experience & relying on the learner
redirect).

Because of this, the MFE can no longer rely on
`lms_web_url` to land a staff user to the legacy
experience. However, the aformentioned change
will also introduce a `legacy_web_url` field
to the API, which we *can* use for this purpose.

TNL-7796
This commit is contained in:
Kyle McCormick
2021-04-07 09:21:07 -04:00
committed by GitHub
parent 32ac3632d0
commit cf58ff3d3f
9 changed files with 41 additions and 19 deletions

View File

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