Skip to content

fix: send availability notification if media is available before approval#2819

Open
fallenbagel wants to merge 1 commit intodevelopfrom
fallenbagel/fix/availability-notification-before-approval
Open

fix: send availability notification if media is available before approval#2819
fallenbagel wants to merge 1 commit intodevelopfrom
fallenbagel/fix/availability-notification-before-approval

Conversation

@fallenbagel
Copy link
Copy Markdown
Collaborator

@fallenbagel fallenbagel commented Apr 3, 2026

Description

When users don't use Sonarr/Radarr and manually fulfill requests, the request stays in PENDING state until the media scanner detects the media. At that point, the scanner auto-approves the request, but notifyApprovedOrDeclined() sees the media is already AVAILABLE and early-returns without sending any notification that is neither approval nor availability.

This changes the early-return guard to send an availability notification instead of silently suppressing all notifications. This should ensure requesters are still informed when their media is ready.

How Has This Been Tested?

(not tested but should work anyways)

Screenshots / Logs (if applicable)

Checklist:

  • I have read and followed the contribution guidelines.
  • Disclosed any use of AI (see our policy)
  • I have updated the documentation accordingly.
  • All new and existing tests passed.
  • Successful build pnpm build
  • Translation keys pnpm i18n:extract
  • Database migration (if required)

Summary by CodeRabbit

  • Bug Fixes
    • Users now receive a "Now Available" notification when a request is already approved and the media is available.
    • Notification messaging is more consistent and admin alerts are suppressed for these availability notices to reduce unnecessary admin noise.

@fallenbagel fallenbagel requested a review from a team as a code owner April 3, 2026 21:44
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 58192a06-7127-4dcf-85a4-91471cda42ed

📥 Commits

Reviewing files that changed from the base of the PR and between 789bc93 and abc8fbe.

📒 Files selected for processing (1)
  • server/entity/MediaRequest.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • server/entity/MediaRequest.ts

📝 Walkthrough

Walkthrough

Modified MediaRequest notification logic so that when media becomes available before an approval, the request (if in APPROVED state) logs at info level and sends a MEDIA_AVAILABLE notification instead of skipping; sendNotification now handles MEDIA_AVAILABLE and suppresses admin notifications.

Changes

Cohort / File(s) Summary
Media Request Notification Handling
server/entity/MediaRequest.ts
Changed notifyApprovedOrDeclined to send Notification.MEDIA_AVAILABLE when appropriate (log level: warninfo), and updated sendNotification to generate a "Now Available" event string and set notifyAdmin = false for MEDIA_AVAILABLE.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested labels

preview

Suggested reviewers

  • gauthier-th
  • 0xSysR3ll

Poem

🐰 I hopped through code and bits tonight,
Found a missing bell that should ring bright.
No approve click needed, the mail takes flight,
Requesters cheer at the arriving light —
Hooray for fixes that make things right! 🎉

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main fix: sending availability notification when media is available before the request is approved.
Linked Issues check ✅ Passed The changes directly address the issue requirements by ensuring notifications are sent when media becomes available even if the request was not manually approved beforehand.
Out of Scope Changes check ✅ Passed All code changes in MediaRequest.ts are narrowly focused on fixing the availability notification behavior as specified in the linked issue.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@server/entity/MediaRequest.ts`:
- Around line 671-681: The availability fallback currently runs regardless of
the request's approval/decline state and can send MEDIA_AVAILABLE even when
this.status === MediaRequestStatus.DECLINED; update the conditional that checks
media[this.is4k ? 'status4k' : 'status'] === MediaStatus.AVAILABLE to also
ensure the request isn't declined (e.g., skip the availability branch if
this.status === MediaRequestStatus.DECLINED) so that
MediaRequest.sendNotification(this, media, Notification.MEDIA_AVAILABLE) is not
called for declined requests and the declined notification path can proceed;
reference the media[...] check, MediaStatus.AVAILABLE, this.status,
MediaRequestStatus.DECLINED, and MediaRequest.sendNotification to locate and
modify the logic.
- Around line 676-680: MediaRequest.sendNotification is being called with
Notification.MEDIA_AVAILABLE but sendNotification lacks a MEDIA_AVAILABLE
branch, causing notifyUser/requester delivery to be left unset; update the
sendNotification implementation (in MediaRequest) to handle
Notification.MEDIA_AVAILABLE explicitly by setting notifyUser (or requester
delivery flag) to true and configuring any requester-specific routing logic so
the original requester receives the notification instead of falling back to
notifyAdmin only.
🪄 Autofix (Beta)

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

Run ID: f05fb088-d4e3-4af9-b6f4-3dbe2c56f364

📥 Commits

Reviewing files that changed from the base of the PR and between 6f9b743 and 789bc93.

📒 Files selected for processing (1)
  • server/entity/MediaRequest.ts

Comment thread server/entity/MediaRequest.ts Outdated
Comment thread server/entity/MediaRequest.ts
…oval

When media becomes available before a pending request is approved, send a MEDIA_AVAILABLE
notification to the requester instead of silently skipping all notifications.

fix #2809
@fallenbagel fallenbagel force-pushed the fallenbagel/fix/availability-notification-before-approval branch from 789bc93 to abc8fbe Compare April 3, 2026 21:52
@seerr-automation-bot seerr-automation-bot added this to the v3.2.0 milestone Apr 3, 2026
@seerr-automation-bot seerr-automation-bot modified the milestones: v3.2.0, v3.2.1 Apr 15, 2026
@fallenbagel fallenbagel enabled auto-merge (squash) April 17, 2026 11:39
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.

Seerr not sending emails for Newly available media unless Previously Approved

3 participants