Skip to content

show resource_category in channel pages#3264

Merged
abeglova merged 1 commit into
mainfrom
ab/show-resource-category-facet-for-channel
Apr 30, 2026
Merged

show resource_category in channel pages#3264
abeglova merged 1 commit into
mainfrom
ab/show-resource-category-facet-for-channel

Conversation

@abeglova
Copy link
Copy Markdown
Contributor

@abeglova abeglova commented Apr 28, 2026

What are the relevant tickets?

https://github.com/mitodl/hq/issues/11064

Description (What does it do?)

This pr updates the channel search to show the resource_category facet in channel pages

Screenshots (if appropriate):

Screenshot 2026-04-28 at 2 35 29 PM

How can this be tested?

If you don't have learning materials attached to a unit with a channel run
docker-compose run web ./manage.py manage.py backpopulate_youtube_data

Go to

http://open.odl.local:8062/c/unit/ocw?resource_type_group=learning_material

and verify that you see the resource category facet

Switch to the "course" and "all" tabs and verify that you do not see the resource category facet

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 28, 2026

OpenAPI Changes

No changes detected

View full changelog

Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

@abeglova abeglova marked this pull request as ready for review April 28, 2026 18:24
Copilot AI review requested due to automatic review settings April 28, 2026 18:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for displaying the resource_category facet on Channel pages (Topic/Department/Unit), aligned with the existing behavior that the facet only appears when resource_type_group=learning_material.

Changes:

  • Enable resource_category as an allowed facet for Topic/Department/Unit channel searches.
  • Add a Channel page test asserting Resource Category is hidden by default and shown when resource_type_group=learning_material.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
frontends/main/src/app-pages/ChannelPage/searchRequests.ts Adds resource_category to the per-channel-type facet allowlist so it can render when present in the facet manifest.
frontends/main/src/app-pages/ChannelPage/ChannelSearch.test.tsx Adds a regression test for conditional visibility of the Resource Category facet based on resource_type_group.

Comment thread frontends/main/src/app-pages/ChannelPage/ChannelSearch.test.tsx Outdated
Comment thread frontends/main/src/app-pages/ChannelPage/ChannelSearch.test.tsx Outdated
Comment on lines 30 to 34
const FACETS_BY_CHANNEL_TYPE: Record<ChannelTypeEnum, string[]> = {
[ChannelTypeEnum.Topic]: [
"free",
"resource_category",
"resource_type",
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

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

resource_category is now enabled as a facet for Topic/Department/Unit channels, but the added test only exercises the Topic case. Consider adding coverage for Department and Unit as well (e.g., test.each over channel types) to ensure the facet shows/hides correctly across all channel page variants.

Copilot generated this review using guidance from repository custom instructions.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

agree with adding the test for all channel types

@shanbady shanbady self-requested a review April 29, 2026 17:09
Copy link
Copy Markdown
Contributor

@shanbady shanbady left a comment

Choose a reason for hiding this comment

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

I agree with copilot's suggestion change (also consider adding the non-channel search page if there is no existing test for that)

Comment on lines 30 to 34
const FACETS_BY_CHANNEL_TYPE: Record<ChannelTypeEnum, string[]> = {
[ChannelTypeEnum.Topic]: [
"free",
"resource_category",
"resource_type",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

agree with adding the test for all channel types

@abeglova
Copy link
Copy Markdown
Contributor Author

Copy link
Copy Markdown
Contributor

@shanbady shanbady left a comment

Choose a reason for hiding this comment

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

👍

@abeglova abeglova force-pushed the ab/show-resource-category-facet-for-channel branch from b3f0a02 to 8a67924 Compare April 30, 2026 12:56
@abeglova abeglova merged commit 3332a49 into main Apr 30, 2026
13 checks passed
@abeglova abeglova deleted the ab/show-resource-category-facet-for-channel branch April 30, 2026 13:12
@odlbot odlbot mentioned this pull request Apr 30, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants