fix: send availability notification if media is available before approval#2819
fix: send availability notification if media is available before approval#2819fallenbagel wants to merge 1 commit intodevelopfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughModified 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 Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ 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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
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
789bc93 to
abc8fbe
Compare
Description
When users don't use Sonarr/Radarr and manually fulfill requests, the request stays in
PENDINGstate until the media scanner detects the media. At that point, the scanner auto-approves the request, butnotifyApprovedOrDeclined()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:
pnpm buildpnpm i18n:extractSummary by CodeRabbit