Skip to content

Conversation

@mcfalld
Copy link

@mcfalld mcfalld commented Jan 4, 2026

Add Per-User Content Rating Filters

Adds support for per-user content rating restrictions across all discovery endpoints. Admins can now configure maximum allowed movie and TV ratings for each user, with unrated content handled via an NR option. The filtering system prioritizes US certifications and falls back to the most restrictive international rating when needed.

Description

Problem

Users (particularly parents managing family accounts) need the ability to restrict content based on movie/TV ratings on a per-user basis. Currently, all users see the same content regardless of age-appropriateness.

Solution

This PR implements comprehensive content rating filters that:

  • Allow admins to set maximum allowed ratings per user (e.g., PG-13 for movies, TV-PG for TV shows)
  • Filter content across all discovery surfaces: discover pages, search results, trending, recommendations, similar content, collections, person filmographies, recently added media, studios, and networks
  • Handle unrated content safely (blocked by default, allowable via NR rating option)
  • Use real TMDB certifications rather than static data

Technical Approach

  • Database: Added maxMovieRating and maxTvRating columns to user_settings table with SQLite migration and PostgreSQL migration
  • Backend: Created async filtering utility (contentFiltering.ts) that fetches per-item certifications from TMDB's movie/TV details endpoints since list results don't include this data
  • Rating Logic: Prioritizes US ratings (MPAA/FCC), falls back to most restrictive international rating if US unavailable, excludes NR/Unrated editions from comparison to avoid director's cut false positives
  • Frontend: Admin-only controls in User Permissions tab with full rating hierarchy dropdowns, bulk edit support for managing multiple users
  • Permission Model: Uses existing Permission.MANAGE_USERS to restrict access to admin users only

Changes Include

  • Database migration: 1736000000000-AddContentRatingFilters.ts
  • Content filtering utility with TMDB integration
  • 9 route files updated with filtering logic
  • 3 entity/interface updates
  • 3 UI components updated (Permissions, Bulk Edit)
  • Translation keys for new UI elements

AI Assistance Notice

This PR was developed with substantial assistance from GitHub Copilot (Claude Sonnet 4.5). The AI helped with:

  • Code structure and organization
  • Database migration patterns following existing conventions
  • TypeScript type definitions
  • React/Formik UI components
  • Debugging TMDB API integration
  • PR documentation

I understand the implementation and have tested it extensively in my local environment.

How Has This Been Tested?

Test Environment

  • Platform: Windows 11
  • Database: SQLite (default seerr setup)
  • Node.js: v22.x
  • Build: Successful pnpm build
  • Migration: Successfully applied on fresh database

Test Scenarios

1. Admin Controls

  • ✅ Set PG-13 movie limit for test user
  • ✅ Set TV-PG TV limit for test user
  • ✅ Verified non-admin users cannot access rating controls
  • ✅ Bulk edit successfully updates multiple users

2. Content Filtering

  • ✅ User with PG-13 limit cannot see R-rated movies in discover/search/trending
  • ✅ User with TV-PG limit cannot see TV-MA shows
  • ✅ Verified filtering on: discover, search, trending, recommendations, similar, collections, person pages, recently added, studios, networks
  • ✅ Unrated content blocked by default (safe for children)
  • ✅ Setting NR allows unrated content through

3. Rating Logic

  • ✅ US ratings prioritized correctly (Ted uses R rating, not international PG)
  • ✅ International fallback works when US rating unavailable
  • ✅ Multiple US release dates handled (uses most restrictive)
  • ✅ NR/Unrated director's cuts don't block theatrical releases

Results

All test scenarios passed. Content filtering works comprehensively across the application with no performance issues observed (async filtering processes efficiently).

Screenshots / Logs

Screenshots can be provided upon request showing:

  • User Permissions tab with rating dropdown controls
  • Bulk Edit modal with rating fields
  • Filtered discover results based on user rating limits
  • Admin vs non-admin view differences

Checklist:

  • I have read and followed the contribution guidelines.
  • Disclosed any use of AI (see our policy)
  • I have updated the documentation accordingly. (Note: Will need wiki/user guide updates post-merge)
  • All new and existing tests passed.
  • Successful build pnpm build
  • Translation keys pnpm i18n:extract
  • Database migration (if required) (Both SQLite and PostgreSQL migrations included)

Adds support for per-user content rating restrictions across all
discovery endpoints. Admins can now configure maximum allowed movie
and TV ratings for each user, with unrated content handled via an NR
option. The filtering system prioritizes US certifications and falls
back to the most restrictive international rating when needed.

Includes database migration for new user settings fields, async TMDB
certification lookup, and admin UI controls with bulk edit support.
@mcfalld mcfalld marked this pull request as ready for review January 4, 2026 10:33
@mcfalld mcfalld requested a review from a team as a code owner January 4, 2026 10:33
@dreulavelle
Copy link

LGTM!

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.

2 participants