Skip to content

Commit

Permalink
fix: fixed course rerun route
Browse files Browse the repository at this point in the history
  • Loading branch information
PKulkoRaccoonGang committed May 9, 2024
1 parent 5c1df3e commit 5385a82
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/studio-home/card-item/CardItem.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('<CardItem />', () => {
const courseTitleLink = getByText(props.displayName);
expect(courseTitleLink).toHaveAttribute('href', `${getConfig().STUDIO_BASE_URL}${props.url}`);
const btnReRunCourse = getByText(messages.btnReRunText.defaultMessage);
expect(btnReRunCourse).toHaveAttribute('href', props.rerunLink);
expect(btnReRunCourse).toHaveAttribute('href', `${getConfig().STUDIO_BASE_URL}${props.rerunLink}`);
const viewLiveLink = getByText(messages.viewLiveBtnText.defaultMessage);
expect(viewLiveLink).toHaveAttribute('href', props.lmsLink);
});
Expand All @@ -63,7 +63,7 @@ describe('<CardItem />', () => {
const dropDownMenu = getByTestId('toggle-dropdown');
fireEvent.click(dropDownMenu);
const btnReRunCourse = getByText(messages.btnReRunText.defaultMessage);
expect(btnReRunCourse).toHaveAttribute('href', props.rerunLink);
expect(btnReRunCourse).toHaveAttribute('href', `${getConfig().STUDIO_BASE_URL}${props.rerunLink}`);
const viewLiveLink = getByText(messages.viewLiveBtnText.defaultMessage);
expect(viewLiveLink).toHaveAttribute('href', props.lmsLink);
});
Expand Down
5 changes: 3 additions & 2 deletions src/studio-home/card-item/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const CardItem = ({
rerunCreatorStatus,
} = useSelector(getStudioHomeData);
const courseUrl = () => new URL(url, getConfig().STUDIO_BASE_URL);
const courseRerunUrl = () => new URL(rerunLink, getConfig().STUDIO_BASE_URL);
const subtitle = isLibraries ? `${org} / ${number}` : `${org} / ${number} / ${run}`;
const readOnlyItem = !(lmsLink || rerunLink || url);
const showActions = !(readOnlyItem || isLibraries);
Expand Down Expand Up @@ -69,7 +70,7 @@ const CardItem = ({
/>
<Dropdown.Menu>
{isShowRerunLink && (
<Dropdown.Item href={rerunLink}>
<Dropdown.Item href={courseRerunUrl().toString()}>
{messages.btnReRunText.defaultMessage}
</Dropdown.Item>
)}
Expand All @@ -83,7 +84,7 @@ const CardItem = ({
{isShowRerunLink && (
<Hyperlink
className="small"
destination={rerunLink}
destination={courseRerunUrl().toString()}
key={`action-row-rerunLink-${courseKey}`}
>
{intl.formatMessage(messages.btnReRunText)}
Expand Down

0 comments on commit 5385a82

Please sign in to comment.