-
Notifications
You must be signed in to change notification settings - Fork 3
Release 0.64.1 #3233
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
Merged
Merged
Release 0.64.1 #3233
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f7e8da7
Update dependency opensearch-py to v3 (#2764)
renovate[bot] fd98a20
Update dependency onnxruntime to v1.24.4 (#2742)
renovate[bot] 2266bf6
Update nginx Docker tag to v1.29.7 (#2986)
renovate[bot] bcae24a
Merge branch 'release'
odlbot 1b1808d
Revert "Update dependency opensearch-py to v3 (#2764)" (#3230)
shanbady 0855c55
remove default slide transition from dialogs (#3229)
gumaerc f6fdcff
feat: implementing the podcast detail page (#3184)
ahtesham-quraish 8ca7e65
feat: track Stay Updated button click with PostHog cta_clicked event …
rachellougee 9bf32e7
Release 0.64.1
odlbot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -138,4 +138,5 @@ export { | |
| videoShortsApi, | ||
| videoPlaylistsApi, | ||
| vectorLearningResourcesSearchApi, | ||
| BASE_PATH, | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
frontends/main/src/app-pages/PodcastPage/PodcastContainer.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import { Container, styled } from "ol-components" | ||
|
|
||
| const PodcastContainer = styled(Container)(({ theme }) => ({ | ||
| maxWidth: "1080px !important", | ||
| padding: "0 !important", | ||
| [theme.breakpoints.down("md")]: { | ||
| padding: "0 16px !important", | ||
| }, | ||
| [theme.breakpoints.down("sm")]: { | ||
| padding: "0 16px !important", | ||
| }, | ||
| })) | ||
|
|
||
| export default PodcastContainer |
217 changes: 217 additions & 0 deletions
217
frontends/main/src/app-pages/PodcastPage/PodcastDetailPage.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,217 @@ | ||
| import React from "react" | ||
| import { factories, setMockResponse, urls } from "api/test-utils" | ||
| import { ResourceTypeEnum } from "api/v1" | ||
| import type { LearningResource, PodcastEpisodeResource } from "api/v1" | ||
| import { renderWithProviders, screen, user } from "@/test-utils" | ||
| import { useFeatureFlagEnabled } from "posthog-js/react" | ||
| import { useFeatureFlagsLoaded } from "@/common/useFeatureFlagsLoaded" | ||
| import { PodcastDetailPage } from "./PodcastDetailPage" | ||
|
|
||
| jest.mock("posthog-js/react") | ||
| jest.mock("@/common/useFeatureFlagsLoaded") | ||
|
|
||
| const mockedUseFeatureFlagEnabled = jest.mocked(useFeatureFlagEnabled) | ||
| const mockedUseFeatureFlagsLoaded = jest.mocked(useFeatureFlagsLoaded) | ||
|
|
||
| jest.mock( | ||
| "@/page-components/LearningResourceDrawer/LearningResourceDrawer", | ||
| () => ({ | ||
| __esModule: true, | ||
| default: jest.fn(() => null), | ||
| }), | ||
| ) | ||
|
|
||
| jest.mock("./PodcastPlayer", () => ({ | ||
| __esModule: true, | ||
| default: jest.fn( | ||
| ({ track }: { track: { title: string; podcastName: string } }) => ( | ||
| <div data-testid="podcast-player"> | ||
| <span data-testid="player-track-title">{track.title}</span> | ||
| <span data-testid="player-podcast-name">{track.podcastName}</span> | ||
| </div> | ||
| ), | ||
| ), | ||
| })) | ||
|
|
||
| const EPISODES_PAGE_SIZE = 5 | ||
|
|
||
| const makeItemsResponse = ( | ||
| episodes: LearningResource[], | ||
| opts: { next?: string | null } = {}, | ||
| ) => ({ | ||
| count: episodes.length, | ||
| next: opts.next ?? null, | ||
| previous: null, | ||
| results: episodes.map((resource, i) => ({ | ||
| id: i + 1, | ||
| child: resource.id, | ||
| parent: 0, | ||
| position: i + 1, | ||
| resource, | ||
| })), | ||
| }) | ||
|
|
||
| const makePodcastEpisodes = (count: number): PodcastEpisodeResource[] => | ||
| Array.from({ length: count }, () => | ||
| factories.learningResources.resource({ | ||
| resource_type: ResourceTypeEnum.PodcastEpisode, | ||
| }), | ||
| ) as PodcastEpisodeResource[] | ||
|
|
||
| const setupApis = ({ | ||
| episodesPage1, | ||
| episodesPage2, | ||
| }: { | ||
| episodesPage1: LearningResource[] | ||
| episodesPage2?: LearningResource[] | ||
| }) => { | ||
| const podcast = factories.learningResources.resource({ | ||
| resource_type: ResourceTypeEnum.Podcast, | ||
| }) | ||
|
|
||
| setMockResponse.get( | ||
| urls.learningResources.details({ id: podcast.id }), | ||
| podcast, | ||
| ) | ||
|
|
||
| // The code normalises the next URL to BASE_PATH + path, where BASE_PATH is "" | ||
| // in tests, so both the next value and the page-2 mock use the plain path. | ||
| const page2Path = episodesPage2 | ||
| ? `${urls.learningResources.items({ id: podcast.id })}?limit=${EPISODES_PAGE_SIZE}&offset=${EPISODES_PAGE_SIZE}` | ||
| : null | ||
|
|
||
| setMockResponse.get( | ||
| `${urls.learningResources.items({ id: podcast.id })}?limit=${EPISODES_PAGE_SIZE}`, | ||
| makeItemsResponse(episodesPage1, { next: page2Path }), | ||
| ) | ||
|
|
||
| if (episodesPage2 && page2Path) { | ||
| setMockResponse.get(page2Path, makeItemsResponse(episodesPage2)) | ||
| } | ||
|
|
||
| return { podcast } | ||
| } | ||
|
|
||
| describe("PodcastDetailPage", () => { | ||
| beforeEach(() => { | ||
| mockedUseFeatureFlagEnabled.mockReturnValue(true) | ||
| mockedUseFeatureFlagsLoaded.mockReturnValue(true) | ||
| }) | ||
|
|
||
| afterEach(() => { | ||
| jest.clearAllMocks() | ||
| }) | ||
|
|
||
| test("renders initial episode list", async () => { | ||
| const episodes = makePodcastEpisodes(3) | ||
| const { podcast } = setupApis({ episodesPage1: episodes }) | ||
|
|
||
| renderWithProviders(<PodcastDetailPage podcastId={String(podcast.id)} />) | ||
|
|
||
| await screen.findByText(episodes[0].title!) | ||
| for (const episode of episodes) { | ||
| expect(screen.getByText(episode.title!)).toBeInTheDocument() | ||
| } | ||
| }) | ||
|
|
||
| test("does not show 'Load more' when there is no next page", async () => { | ||
| const episodes = makePodcastEpisodes(3) | ||
| const { podcast } = setupApis({ episodesPage1: episodes }) | ||
|
|
||
| renderWithProviders(<PodcastDetailPage podcastId={String(podcast.id)} />) | ||
|
|
||
| await screen.findByText(episodes[0].title!) | ||
| expect( | ||
| screen.queryByRole("button", { name: /load more episodes/i }), | ||
| ).not.toBeInTheDocument() | ||
| }) | ||
|
|
||
| test("shows 'Load more' when API returns a next page URL", async () => { | ||
| const episodes = makePodcastEpisodes(EPISODES_PAGE_SIZE) | ||
| const { podcast } = setupApis({ | ||
| episodesPage1: episodes, | ||
| episodesPage2: [], | ||
| }) | ||
|
|
||
| renderWithProviders(<PodcastDetailPage podcastId={String(podcast.id)} />) | ||
|
|
||
| await screen.findByText(episodes[0].title!) | ||
| expect( | ||
| screen.getByRole("button", { name: /load more episodes/i }), | ||
| ).toBeInTheDocument() | ||
| }) | ||
|
|
||
| test("loads next page when 'Load more' is clicked", async () => { | ||
| const page1 = makePodcastEpisodes(EPISODES_PAGE_SIZE) | ||
| const page2 = makePodcastEpisodes(2) | ||
| const { podcast } = setupApis({ | ||
| episodesPage1: page1, | ||
| episodesPage2: page2, | ||
| }) | ||
|
|
||
| renderWithProviders(<PodcastDetailPage podcastId={String(podcast.id)} />) | ||
|
|
||
| await screen.findByText(page1[0].title!) | ||
| await user.click( | ||
| screen.getByRole("button", { name: /load more episodes/i }), | ||
| ) | ||
|
|
||
| for (const episode of page2) { | ||
| await screen.findByText(episode.title!) | ||
| } | ||
|
|
||
| // No more pages — button should disappear | ||
| expect( | ||
| screen.queryByRole("button", { name: /load more episodes/i }), | ||
| ).not.toBeInTheDocument() | ||
| }) | ||
|
|
||
| test("clicking play renders the player with correct track and podcast name", async () => { | ||
| const episodes = makePodcastEpisodes(2) | ||
| const { podcast } = setupApis({ episodesPage1: episodes }) | ||
|
|
||
| renderWithProviders(<PodcastDetailPage podcastId={String(podcast.id)} />) | ||
|
|
||
| await screen.findByText(episodes[0].title!) | ||
| expect(screen.queryByTestId("podcast-player")).not.toBeInTheDocument() | ||
|
|
||
| await user.click( | ||
| screen.getByRole("button", { name: `Play ${episodes[0].title}` }), | ||
| ) | ||
|
|
||
| expect(screen.getByTestId("podcast-player")).toBeInTheDocument() | ||
| expect(screen.getByTestId("player-track-title")).toHaveTextContent( | ||
| episodes[0].title!, | ||
| ) | ||
| expect(screen.getByTestId("player-podcast-name")).toHaveTextContent( | ||
| podcast.title!, | ||
| ) | ||
| }) | ||
|
|
||
| test("shows 'No episodes found' when episode list is empty", async () => { | ||
| const { podcast } = setupApis({ episodesPage1: [] }) | ||
|
|
||
| renderWithProviders(<PodcastDetailPage podcastId={String(podcast.id)} />) | ||
|
|
||
| await screen.findByText(/no episodes found/i) | ||
| }) | ||
|
|
||
| test("disables play button for episodes without audio source", async () => { | ||
| const [episodeWithoutAudio] = makePodcastEpisodes(1) | ||
| if (episodeWithoutAudio.podcast_episode) { | ||
| episodeWithoutAudio.podcast_episode.audio_url = "" | ||
| episodeWithoutAudio.podcast_episode.episode_link = "" | ||
| } | ||
|
|
||
| const { podcast } = setupApis({ episodesPage1: [episodeWithoutAudio] }) | ||
|
|
||
| renderWithProviders(<PodcastDetailPage podcastId={String(podcast.id)} />) | ||
|
|
||
| const playButton = await screen.findByRole("button", { | ||
| name: `Play ${episodeWithoutAudio.title}`, | ||
| }) | ||
|
|
||
| expect(playButton).toBeDisabled() | ||
| expect(screen.queryByTestId("podcast-player")).not.toBeInTheDocument() | ||
| }) | ||
| }) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: The infinite query for podcast episodes is broken because
pageParamis alwaysnull, causing only the first page of results to be fetched repeatedly.Severity: HIGH
Suggested Fix
Investigate why
pageParamis alwaysnullin theinfiniteItemsquery. ThegetNextPageParamfunction within theuseInfiniteQueryoptions should be corrected to properly extract the URL for the next page from the API response'snextfield. Ensure this value is returned so subsequent fetches can use it.Prompt for AI Agent
Did we get this right? 👍 / 👎 to inform future reviews.