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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ repos:
pass_filenames: false
always_run: true
- repo: https://github.com/scop/pre-commit-shfmt
rev: v3.12.0-2
rev: v3.13.1-1
hooks:
- id: shfmt
- repo: https://github.com/adrienverge/yamllint.git
Expand Down Expand Up @@ -90,7 +90,7 @@ repos:
- "config/keycloak/realms/ol-local-realm.json"
additional_dependencies: ["gibberish-detector"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.15.1"
rev: "v0.15.12"
hooks:
- id: ruff-format
- id: ruff
Expand Down
9 changes: 9 additions & 0 deletions RELEASE.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Release Notes
=============

Version 0.65.1
--------------

- do not promote ocw page contentfiles to resources (#3261)
- dashboard b2c series certificate display (#3256)
- flaky test test_learning_resources_serializer (#3252)
- [pre-commit.ci] pre-commit autoupdate (#2973)
- Update dependency sharp to v0.34.5 (#2707)

Version 0.65.0 (Released April 28, 2026)
--------------

Expand Down
2 changes: 1 addition & 1 deletion frontends/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"react-hotkeys-hook": "^5.2.1",
"react-markdown": "^10.0.0",
"react-slick": "^0.31.0",
"sharp": "0.34.4",
"sharp": "0.34.5",
"slick-carousel": "^1.8.1",
"tiny-invariant": "^1.3.3",
"video.js": "^8.23.7",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2291,5 +2291,103 @@ describe("EnrollmentDisplay", () => {
expect(cards[1]).toHaveTextContent(courseA.title)
expect(cards[2]).toHaveTextContent(courseB.title)
})

test("displays certificate button when program enrollment has a certificate", async () => {
const mitxOnlineUser = mitxonline.factories.user.user()
setMockResponse.get(mitxonline.urls.userMe.get(), mitxOnlineUser)

const certUuid = "test-program-cert-uuid"
const program = mitxonline.factories.programs.program({
id: 456,
title: "Program With Certificate",
courses: [10, 11],
})
const programEnrollment =
mitxonline.factories.enrollment.programEnrollmentV3({
program: {
id: program.id,
title: program.title,
live: program.live,
program_type: program.program_type,
readable_id: program.readable_id,
},
certificate: {
uuid: certUuid,
link: `/certificate/program/${certUuid}/`,
},
})
const courses = mitxonline.factories.courses.courses({ count: 2 })

mockedUseFeatureFlagEnabled.mockReturnValue(true)
setMockResponse.get(mitxonline.urls.enrollment.enrollmentsListV3(), [])
setMockResponse.get(
mitxonline.urls.programEnrollments.enrollmentsListV3(),
[programEnrollment],
)
setMockResponse.get(mitxonline.urls.programs.programDetail(456), program)
setMockResponse.get(
mitxonline.urls.courses.coursesList({
id: program.courses,
page_size: program.courses.length,
}),
courses,
)

renderWithProviders(<EnrollmentDisplay programId={456} />)

await screen.findByText("Program With Certificate")
const certButton = screen.getByRole("link", { name: "Certificate" })
const expectedCertHref = programEnrollment.certificate?.link?.replace(
/\/$/,
"",
)
expect(certButton).toBeInTheDocument()
expect(certButton).toHaveAttribute("href", expectedCertHref)
expect(certButton).not.toHaveAttribute("target")
})

test("does not display certificate button when program enrollment has no certificate", async () => {
const mitxOnlineUser = mitxonline.factories.user.user()
setMockResponse.get(mitxonline.urls.userMe.get(), mitxOnlineUser)

const program = mitxonline.factories.programs.program({
id: 457,
title: "Program Without Certificate",
courses: [12, 13],
})
const programEnrollment =
mitxonline.factories.enrollment.programEnrollmentV3({
program: {
id: program.id,
title: program.title,
live: program.live,
program_type: program.program_type,
readable_id: program.readable_id,
},
certificate: null,
})
const courses = mitxonline.factories.courses.courses({ count: 2 })

mockedUseFeatureFlagEnabled.mockReturnValue(true)
setMockResponse.get(mitxonline.urls.enrollment.enrollmentsListV3(), [])
setMockResponse.get(
mitxonline.urls.programEnrollments.enrollmentsListV3(),
[programEnrollment],
)
setMockResponse.get(mitxonline.urls.programs.programDetail(457), program)
setMockResponse.get(
mitxonline.urls.courses.coursesList({
id: program.courses,
page_size: program.courses.length,
}),
courses,
)

renderWithProviders(<EnrollmentDisplay programId={457} />)

await screen.findByText("Program Without Certificate")
const certButton = screen.queryByRole("link", { name: "Certificate" })
expect(certButton).not.toBeInTheDocument()
})
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
styled,
theme,
} from "ol-components"
import { Alert } from "@mitodl/smoot-design"
import { Alert, ButtonLink } from "@mitodl/smoot-design"
import { keepPreviousData, useQuery } from "@tanstack/react-query"
import {
EnrollmentStatus,
Expand Down Expand Up @@ -43,6 +43,7 @@
import NotFoundPage from "@/app-pages/ErrorPage/NotFoundPage"
import { ProgramAsCourseCard } from "./ProgramAsCourseCard"
import { getIdsFromReqTree } from "@/common/mitxonline"
import { RiAwardFill } from "@remixicon/react"

const Wrapper = styled.div(({ theme }) => ({
marginTop: "32px",
Expand Down Expand Up @@ -107,6 +108,11 @@
},
}))

export const ProgramCertificateButton = styled(ButtonLink)(({ theme }) => ({
color: theme.custom.colors.red,
width: "120px",
}))

const alphabeticalSort = (a: CourseRunEnrollmentV3, b: CourseRunEnrollmentV3) =>
a.run.course.title.localeCompare(b.run.course.title)

Expand Down Expand Up @@ -417,7 +423,7 @@
enabled: Boolean(enrolledInProgram && requiredProgramIds.length > 0),
})

const requiredProgramList = requiredPrograms?.results ?? []

Check warning on line 426 in frontends/main/src/app-pages/DashboardPage/CoursewareDisplay/EnrollmentDisplay.tsx

View workflow job for this annotation

GitHub Actions / javascript-tests

The 'requiredProgramList' logical expression could make the dependencies of useMemo Hook (at line 550) change on every render. To fix this, wrap the initialization of 'requiredProgramList' in its own useMemo() Hook

Check warning on line 426 in frontends/main/src/app-pages/DashboardPage/CoursewareDisplay/EnrollmentDisplay.tsx

View workflow job for this annotation

GitHub Actions / javascript-tests

The 'requiredProgramList' logical expression could make the dependencies of useMemo Hook (at line 441) change on every render. To fix this, wrap the initialization of 'requiredProgramList' in its own useMemo() Hook

const programAsCourseCourseIds = React.useMemo(() => {
const uniqueIds = new Set<number>()
Expand Down Expand Up @@ -550,6 +556,8 @@
programEnrollmentsById,
)

const programCertificateUrl = programEnrollment?.certificate?.link ?? null

if (isLoading) {
return (
<Stack direction="column">
Expand Down Expand Up @@ -578,14 +586,26 @@
<Typography component="h1" variant="h3" paddingBottom="32px">
{program?.title}
</Typography>
<Typography variant="body2">
You have completed
<Typography component="span" variant="subtitle2">
{" "}
{completedCount} of {totalCount} courses{" "}
<Stack direction="row" justifyContent="space-between">
<Typography variant="body2">
You have completed
<Typography component="span" variant="subtitle2">
{" "}
{completedCount} of {totalCount} courses{" "}
</Typography>
for this program.
</Typography>
for this program.
</Typography>
{programCertificateUrl && (
<ProgramCertificateButton
variant="bordered"
size="small"
startIcon={<RiAwardFill />}
href={programCertificateUrl}
>
Certificate
</ProgramCertificateButton>
)}
</Stack>
</Stack>
{requirementSections.map((section, index) => {
const { completed: sectionCompleted, total: sectionTotal } =
Expand Down
Loading
Loading