fix: use absolute URL for Export Tags menu item
Use absolute URL for Export Tags menu item so that the menu item works no matter where in the course it's used. Fix this issue: https://github.com/openedx/frontend-app-authoring/issues/1380
(cherry picked from commit 774728a9c0)
This commit is contained in:
@@ -125,7 +125,8 @@ const CourseOutline = ({ courseId }) => {
|
||||
const [toastMessage, setToastMessage] = useState(/** @type{null|string} */ (null));
|
||||
|
||||
useEffect(() => {
|
||||
if (location.hash === '#export-tags') {
|
||||
// Wait for the course data to load before exporting tags.
|
||||
if (courseId && courseName && location.hash === '#export-tags') {
|
||||
setToastMessage(intl.formatMessage(messages.exportTagsCreatingToastMessage));
|
||||
getTagsExportFile(courseId, courseName).then(() => {
|
||||
setToastMessage(intl.formatMessage(messages.exportTagsSuccessToastMessage));
|
||||
@@ -136,7 +137,7 @@ const CourseOutline = ({ courseId }) => {
|
||||
// Delete `#export-tags` from location
|
||||
window.location.href = '#';
|
||||
}
|
||||
}, [location]);
|
||||
}, [location, courseId, courseName]);
|
||||
|
||||
const [sections, setSections] = useState(sectionsList);
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ export const useToolsMenuItems = courseId => {
|
||||
},
|
||||
...(getConfig().ENABLE_TAGGING_TAXONOMY_PAGES === 'true'
|
||||
? [{
|
||||
href: '#export-tags',
|
||||
href: `${studioBaseUrl}/course/${courseId}#export-tags`,
|
||||
title: intl.formatMessage(messages['header.links.exportTags']),
|
||||
}] : []
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user