feat: prevent requests before digital release - #3349
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
Included review availability: Your plan includes up to 10 reviews per rolling hour; 9 remain after this review. 📝 WalkthroughWalkthroughRelease-date restrictions now control movie and TV requests. The setting defaults to disabled, supports manager bypasses, validates TMDB release data, returns ChangesRelease restriction flow
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: ⚪ Minimal · up to This opt-in release-date request restriction is merge-ready after normal checks and review; no actionable merge-blocking risk remains. Sequence Diagram(s)sequenceDiagram
participant RequestRoute
participant MediaRequest
participant TheMovieDb
RequestRoute->>MediaRequest: Create or update request
MediaRequest->>TheMovieDb: Fetch release metadata
TheMovieDb-->>MediaRequest: Return release dates
MediaRequest->>MediaRequest: Evaluate restriction
MediaRequest-->>RequestRoute: Return result or restriction error
RequestRoute-->>RequestRoute: Send 403 MEDIA_NOT_RELEASED
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/using-seerr/settings/general.md`:
- Around line 76-81: Update the Release Date Restrictions documentation to
describe the existing “Allow Requests with Unknown Release Dates” setting:
unknown movie digital-release or TV season air dates remain requestable when
enabled and are blocked when disabled, while preserving the documented behavior
for valid dates and existing requests.
In `@server/utils/releaseEligibility.ts`:
- Around line 21-24: Update release restriction evaluation so unknown release
dates honor a new unknown-release-date option: add the option to
ReleaseRestrictionOptions, block unknown eligibility when disabled in
evaluateReleaseRestriction, and pass the configured setting from MediaRequest.
At server/utils/releaseEligibility.test.ts:120-132, cover both enabled and
disabled policies; at server/routes/request.test.ts:240-253, verify a movie with
an unknown date returns MEDIA_NOT_RELEASED when disabled.
- Around line 79-80: Update the digital-release check in release eligibility to
compare each validated release calendar date with today’s calendar date, rather
than rejecting based on timestamp time-of-day; allow releases occurring later on
the current day while preserving rejection of earlier dates. Add a test covering
a same-day release with a later time.
In `@src/components/Settings/SettingsMain/index.tsx`:
- Around line 65-67: Update the releaseDateRestrictionEnabledTip text in
src/components/Settings/SettingsMain/index.tsx (lines 65-67) and the
corresponding English catalog entry in src/i18n/locale/en.json (lines 1041-1042)
to say “Digital release in any region” instead of “worldwide Digital release,”
preserving the rest of the restriction description.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 6b6190fe-344f-4d2c-8221-fa6ff4fd1f78
📒 Files selected for processing (14)
docs/using-seerr/settings/general.mdseerr-api.ymlserver/constants/error.tsserver/entity/MediaRequest.tsserver/interfaces/api/settingsInterfaces.tsserver/lib/settings/index.tsserver/routes/request.test.tsserver/routes/request.tsserver/utils/releaseEligibility.test.tsserver/utils/releaseEligibility.tssrc/components/Settings/SettingsMain/index.tsxsrc/context/SettingsContext.tsxsrc/i18n/locale/en.jsonsrc/pages/_app.tsx
|
This pull request has merge conflicts. Please resolve the conflicts so the PR can be successfully reviewed and merged. |
505bb68 to
c0be4a4
Compare
Description
This is an opt-in (disabled by default) global restriction for requests involving media that has not yet been released. I've decided to intentionally focus on the smallest implementation to start addressing #1346 and can continue with any follow up MRs if needed based on feedback. This work does overlap with #1739 but I'm happy to collaborate (can wait until that PR is merged or combine the two).
When Enable Release Date Restrictions is enabled:
How Has This Been Tested?
Tested on the branch:
seasons: all, newly added seasons, database mutation prevention, existing request-management operations, and requests made on behalf of another user.Screenshots / Logs
Settings -> General

Admin's Perspective (Movie):

User's Perspective (Movie):

Admin's Perspective (TV Show):



User's Perspective (TV Show - Unreleased season's button toggle will be greyed out):


Checklist:
pnpm buildpnpm i18n:extractSummary by CodeRabbit
New Features
Documentation
API
403error response.