Skip to content
Closed
Show file tree
Hide file tree
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
11 changes: 11 additions & 0 deletions RELEASE.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
Release Notes
=============

Version 0.13.9
--------------

- Updates to page titles (#1121)
- Shanbady/minor UI updates (#1118)
- Shanbady/navigation UI fixes (#1119)
- mitx - only ingest published courses (#1102)
- Make resource.prices = most recent published run prices if there is no next run (#1116)
- switch default sort to use popular instead of created on (#1120)
- Fix populate_featured_lists mgmt command (#1097)

Version 0.13.8 (Released June 20, 2024)
--------------

Expand Down
2 changes: 2 additions & 0 deletions frontends/jest.jsdom.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { resolve } from "path"
import type { Config } from "@jest/types"

process.env.SITE_NAME = "MIT Open"

/**
* Base configuration for jest tests.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ describe("Footer", () => {
"About Us": urls.ABOUT,
Accessibility: urls.ACCESSIBILITY,
"Privacy Policy": urls.PRIVACY,
"Terms of Service": urls.TERMS,
"Contact Us": urls.CONTACT,
}
const footer = screen.getByRole("contentinfo")
Expand All @@ -35,7 +34,7 @@ describe("Footer", () => {
expect(address).toHaveTextContent("Massachusetts Institute of Technology")
expect(address).toHaveTextContent("77 Massachusetts Avenue")
expect(address).toHaveTextContent("Cambridge, MA 02139")
expect(links).toHaveLength(7)
expect(links).toHaveLength(6)
for (const link of links) {
expect(link).toHaveAttribute(
"href",
Expand Down
4 changes: 0 additions & 4 deletions frontends/mit-open/src/page-components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,6 @@ const Footer: FunctionComponent = () => {
text="Privacy Policy"
href={urls.PRIVACY}
/>
<FooterLinkComponent
text="Terms of Service"
href={urls.TERMS}
/>
<FooterLinkComponent text="Contact Us" href={urls.CONTACT} />
</FooterLinksContainer>
<FooterCopyrightContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ describe("UserMenu", () => {
test("Authenticated users see the Log Out link", async () => {
const isAuthenticated = true
const initialUrl = "/foo/bar?cat=meow"
const expected = { text: "Log out", url: urlConstants.LOGOUT }
const expected = { text: "Log Out", url: urlConstants.LOGOUT }
setMockResponse.get(urls.userMe.get(), {
is_authenticated: isAuthenticated,
})
Expand Down
1 change: 1 addition & 0 deletions frontends/mit-open/src/page-components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { useUserMe } from "api/hooks/user"
const Bar = styled(AppBar)(({ theme }) => ({
height: "60px",
padding: "0 8px",
borderBottom: `1px solid ${theme.custom.colors.lightGray2}`,
backgroundColor: theme.custom.colors.white,
color: theme.custom.colors.darkGray1,
display: "flex",
Expand Down
13 changes: 3 additions & 10 deletions frontends/mit-open/src/page-components/Header/UserMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const UserMenuContainer = styled.button({
})

const LoginButtonContainer = styled(FlexContainer)(({ theme }) => ({
paddingRight: "32px",
paddingRight: "16px",
"&:hover": {
textDecoration: "none",
},
Expand Down Expand Up @@ -109,20 +109,14 @@ const UserMenu: React.FC<UserMenuProps> = ({ variant }) => {
allow: !!user?.is_authenticated,
href: urls.DASHBOARD,
},
{
label: "User Lists",
key: "userlists",
allow: !!user?.is_authenticated,
href: urls.USERLIST_LISTING,
},
{
label: "Learning Paths",
key: "learningpaths",
allow: !!user?.is_learning_path_editor,
href: urls.LEARNINGPATH_LISTING,
},
{
label: "Log out",
label: "Log Out",
key: "logout",
allow: !!user?.is_authenticated,
href: urls.LOGOUT,
Expand Down Expand Up @@ -159,12 +153,11 @@ const UserMenu: React.FC<UserMenuProps> = ({ variant }) => {
<FlexContainer className="login-button-desktop">
<ButtonLink
data-testid="login-button-desktop"
edge="circular"
size="small"
reloadDocument={true}
href={loginUrl}
>
Sign Up / Login
Sign Up / Log In
</ButtonLink>
</FlexContainer>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const SearchSubscriptionToggle = ({
return [
{
key: "unsubscribe",
label: "Unsubscribe",
label: "Unfollow",
onClick: () => unsubscribe(subscriptionId),
},
]
Expand All @@ -51,7 +51,7 @@ const SearchSubscriptionToggle = ({
<SimpleMenu
trigger={
<Button variant="primary" endIcon={<ExpandMoreSharpIcon />}>
Subscribed
Follow
</Button>
}
items={unsubscribeItems}
Expand All @@ -69,7 +69,7 @@ const SearchSubscriptionToggle = ({
})
}
>
Subscribe
Follow
</Button>
)
}
Expand Down
2 changes: 1 addition & 1 deletion frontends/mit-open/src/pages/AboutPage/AboutPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe("AboutPage", () => {
url: commonUrls.ABOUT,
})
await waitFor(() => {
expect(document.title).toBe("About Us")
expect(document.title).toBe("About Us | MIT Open")
})
screen.getByRole("heading", {
name: "About Us",
Expand Down
4 changes: 1 addition & 3 deletions frontends/mit-open/src/pages/AboutPage/AboutPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ const AboutPage: React.FC = () => {
return (
<Container>
<PageContainer>
<MetaTags>
<title>About Us</title>
</MetaTags>
<MetaTags title="About Us" />
<BannerContainer>
<BannerContainerInner>
<Breadcrumbs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe("ArticleDetailsPage", () => {
screen.getByText(article.html)

await waitFor(() => {
expect(document.title).toBe(article.title)
expect(document.title).toBe(`${article.title} | MIT Open`)
})
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ const ArticlesDetailPage: React.FC = () => {
src="/static/images/course_search_banner.png"
className="articles-detail-page"
>
<MetaTags>
<title>{article.data?.title}</title>
</MetaTags>
<MetaTags title={article.data?.title} />
<Container maxWidth="sm">
<GridContainer>
<GridColumn variant="single-full" container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe("ArticleEditPage", () => {
expect(bodyInput).toBeInstanceOf(HTMLTextAreaElement)

await waitFor(() => {
expect(document.title).toBe(`Editing: ${article.title}`)
expect(document.title).toBe(`${article.title} | Edit | MIT Open`)
})
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const ArticleEditPage: React.FC = () => {
[navigate, id],
)
const goHome = useCallback(() => navigate("/"), [navigate])
const title = `Editing: ${article.data?.title ?? ""}`
const title = article.data?.title ? `${article.data?.title} | Edit` : "Edit"
return (
<ArticleUpsertPage title={title}>
<ArticleUpsertForm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ const ArticleUpsertPage: React.FC<ArticleUpsertPageProps> = ({
}) => {
return (
<BannerPage src="/static/images/course_search_banner.png">
<MetaTags>
<title>{title}</title>
</MetaTags>
<MetaTags title={title} />
<Container maxWidth="sm">
<GridContainer>
<GridColumn variant="single-full">{children}</GridColumn>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ describe("DashboardPage", () => {
setupAPIs()
renderWithProviders(<DashboardPage />)
await waitFor(() => {
expect(document.title).toBe("User Home")
expect(document.title).toBe("Your MIT Learning Journey | MIT Open")
})
screen.getByRole("heading", {
name: "Your MIT Learning Journey",
Expand Down
4 changes: 1 addition & 3 deletions frontends/mit-open/src/pages/DashboardPage/DashboardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -415,9 +415,7 @@ const DashboardPage: React.FC = () => {
<Background>
<Page>
<DashboardContainer>
<MetaTags>
<title>User Home</title>
</MetaTags>
<MetaTags title="Your MIT Learning Journey" />
<TabContext value={tabValue}>
<DashboardGrid>
<DashboardGridItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ describe("DepartmentListingPage", () => {
}
}

it("Has a page title", async () => {
it("Has correct page title", async () => {
setupApis()
renderWithProviders(<DepartmentListingPage />)
await waitFor(() => {
expect(document.title).toBe("MIT Open | Departments")
expect(document.title).toBe("Departments | MIT Open")
})
screen.getByRole("heading", { name: "Departments" })
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,7 @@ const DepartmentListingPage: React.FC = () => {

return (
<Page>
<MetaTags>
<title>MIT Open | Departments</title>
</MetaTags>
<MetaTags title="Departments" />
<Banner
backgroundUrl="/static/images/background_steps.jpeg"
title="Departments"
Expand Down
10 changes: 5 additions & 5 deletions frontends/mit-open/src/pages/ErrorPage/ErrorPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ test.each([{ status: 401 }, { status: 403 }])(
// redirect elsewhere.
setup(status, { user: { is_authenticated: true } })
await waitFor(() => {
expect(document.title).toBe("Not Allowed")
expect(document.title).toBe("Not Allowed | MIT Open")
})
},
)
Expand All @@ -54,15 +54,15 @@ test("ErrorPage shows NotFound on API 404 errors", async () => {
allowConsoleErrors()
setup(404)
await waitFor(() => {
expect(document.title).toBe("Not Found")
expect(document.title).toBe("Not Found | MIT Open")
})
})

test("ErrorPage shows NotFound on frontend routing 404 errors", async () => {
allowConsoleErrors()
renderTestApp({ url: "/some-fake-route" })
await waitFor(() => {
expect(document.title).toBe("Not Found")
expect(document.title).toBe("Not Found | MIT Open")
})
})

Expand All @@ -87,7 +87,7 @@ test("ErrorPage shows ForbiddenPage on restricted routes.", async () => {
{ user: { is_authenticated: true } },
)
await waitFor(() => {
expect(document.title).toBe("Not Allowed")
expect(document.title).toBe("Not Allowed | MIT Open")
})
})

Expand All @@ -107,7 +107,7 @@ test("ErrorPage shows fallback and logs unexpected errors", async () => {
{ user: { is_authenticated: true } },
)
await waitFor(() => {
expect(document.title).toBe("Not Allowed")
expect(document.title).toBe("Not Allowed | MIT Open")
})
expect(consoleError).toHaveBeenCalledWith(Error("Some Error"))
})
3 changes: 1 addition & 2 deletions frontends/mit-open/src/pages/ErrorPage/ErrorPageTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ const ErrorPageTemplate: React.FC<ErrorPageTemplateProps> = ({
return (
<Container maxWidth="sm">
<MuiCard sx={{ marginTop: "1rem" }}>
<MetaTags>
<MetaTags title={title}>
<meta name="robots" content="noindex,noarchive" />
<title>{title}</title>
</MetaTags>
<CardContent>{children}</CardContent>
<CardActions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test("The ForbiddenPage loads with meta", async () => {
})
renderWithProviders(<ForbiddenPage />)
await waitFor(() => {
expect(document.title).toBe("Not Allowed")
expect(document.title).toBe("Not Allowed | MIT Open")
})

const meta = document.head.querySelector('meta[name="robots"]')
Expand Down
4 changes: 1 addition & 3 deletions frontends/mit-open/src/pages/FieldPage/EditFieldPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ const EditFieldPage: React.FC = () => {
name={field.data?.name}
channelType={field.data?.channel_type}
>
<MetaTags>
<title>Edit {field.data.title} Channel</title>
</MetaTags>
<MetaTags title={[field.data.title, "Edit"]} />
{field.data.is_moderator ? (
<TabContext value={tabValue}>
<div className="page-subbanner">
Expand Down
8 changes: 4 additions & 4 deletions frontends/mit-open/src/pages/FieldPage/FieldPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,26 +191,26 @@ describe("FieldPage", () => {
const { field } = setupApis({ search_filter: "q=ocw" }, {}, true, true)
renderTestApp({ url: `/c/${field.channel_type}/${field.name}` })
await screen.findByText(field.title)
const subscribedButton = await screen.findByText("Subscribed")
const subscribedButton = await screen.findByText("Follow")
assertInstanceOf(subscribedButton, HTMLButtonElement)
user.click(subscribedButton)
const unsubscribeButton = await screen.findByText("Unsubscribe")
const unsubscribeButton = await screen.findByText("Unfollow")
assertInstanceOf(unsubscribeButton, HTMLLIElement)
})

it("Displays the subscribe toggle if the user is authenticated but not subscribed", async () => {
const { field } = setupApis({ search_filter: "q=ocw" }, {}, true, false)
renderTestApp({ url: `/c/${field.channel_type}/${field.name}` })
await screen.findByText(field.title)
const subscribeButton = await screen.findByText("Subscribe")
const subscribeButton = await screen.findByText("Follow")
assertInstanceOf(subscribeButton, HTMLButtonElement)
})
it("Hides the subscribe toggle if the user is not authenticated", async () => {
const { field } = setupApis({ search_filter: "q=ocw" }, {}, false, false)
renderTestApp({ url: `/c/${field.channel_type}/${field.name}` })
await screen.findByText(field.title)
await waitFor(() => {
expect(screen.queryByText("Subscribe")).not.toBeInTheDocument()
expect(screen.queryByText("Follow")).not.toBeInTheDocument()
})
})
})
Loading