Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correct redirect to taxonomies page #1547

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/content-tags-drawer/ContentTagsDrawer.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { getConfig } from '@edx/frontend-platform';
import React, { useContext, useEffect } from 'react';
import {
Container,
Expand Down Expand Up @@ -60,7 +61,13 @@
size="inline"
variant="link"
className="text-info-500 p-0 enable-taxonomies-button"
onClick={() => navigate('/taxonomies')}
onClick={() => {
if (window.top && window.top !== window) {
window.top.location.href = `${getConfig().COURSE_AUTHORING_MICROFRONTEND_URL}/taxonomies`;

Check warning on line 66 in src/content-tags-drawer/ContentTagsDrawer.tsx

View check run for this annotation

Codecov / codecov/patch

src/content-tags-drawer/ContentTagsDrawer.tsx#L66

Added line #L66 was not covered by tests
} else {
navigate('/taxonomies');
}
}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! We never really test without any taxonomies so hadn't encountered this.

The bug is probably a non-issue on master anymore, because everyone is expected to use the new unit page and the legacy page is now off by default. But it's likely an issue in Sumac.

I notice that this is currently using a <Button but that's incorrect for a link that triggers a navigation. This should really just be a <Link> component (from react-router-dom) and then I think you can simplify it to <Link to="/taxonomies" target="_top" className="..."> and get rid of all the javascript.

>
{ intl.formatMessage(messages.emptyDrawerContentLink) }
</Button>
Expand Down
Loading