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:
Jillian
2024-10-26 13:20:04 +10:30
committed by GitHub
parent 3d8d248599
commit 62dfb75169
2 changed files with 4 additions and 3 deletions

View File

@@ -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);

View File

@@ -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']),
}] : []
),