Repository navigation
fix: interactive search from My Requests picks for that request - #463
Merged
Merged
Conversation
My Requests opened the book details without the request id, so a pick went down the create-new-request path and was refused as already requested. The card now passes the request id, owner and type; an ebook request searches ebook sources for that request. - requests/[id]/interactive-search-ebook and select-ebook accept the request owner as well as admins (another user gets 403); a non-admin pick follows the approval settings - select-ebook works for an ebook request with no parent audiobook request - request-with-torrent says what is happening when the book is already downloading, processing or awaiting approval (#291), and refuses a pick that would open a second request next to another user's open request Co-authored-by: zpersichetti <17482716+zpersichetti@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…earch-existing-request
…281) - select-ebook and interactive-search-ebook answer 404 for a deleted request (and a deleted parent), for owner and admin alike. - A non-admin may only pick for an ebook request in select-ebook. - A user's auto-approved ebook pick sends the request_approved notification. - The ebook pick toast says the pick was sent for approval when it was. - request-with-torrent uses resolveAutoApprove() for its approval check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…#281) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…earch-existing-request
kikootwo
marked this pull request as ready for review
October 27, 2026 06:59
This was referenced Oct 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #281
Includes the change from #291 by @zpersichetti (re-implemented here with tighter tests; credited in the squash commit).
What changed
RequestCardnow passes the request id, owner and type toAudiobookDetailsModal, the same way the search page and admin panel already do. Interactive Search on an ownpending/failed/awaiting_search/awaiting_releaseaudiobook request picks for that request throughselect-torrent.pending/failed/awaiting_searchebook request it searches and picks for that request (requests/[id]/interactive-search-ebook+select-ebook); in other statuses it searches by ASIN.requests/[id]/interactive-search-ebookandrequests/[id]/select-ebookwere admin-only. They now accept the request's owner or an admin; another user gets 403, and interactive search access is required, as on the other pick routes. A non-admin pick follows the approval settings (newresolveAutoApprove()insrc/lib/utils/permissions.ts): if approval is needed, the ebook request goes toawaiting_approvalwith the pick stored, and the admin approve already handles that.select-ebookalso works for an ebook request with no parent audiobook request (a book that was in the library before RMAB requested it). A non-admin may only pass their own ebook request toselect-ebook(an audiobook request id is 403), and a user's auto-approved pick sends therequest_approvednotification, as the by-ASIN route andselect-torrentdo. Both routes answer 404 for a deleted request (or a deleted parent), for the owner and an admin alike.InteractiveTorrentSearchModalpassesneedsApprovaltoonSuccess).request-with-torrent(from Fix misleading "already requested" error on in-progress downloads #291): a book whose request isdownloading,processing,awaiting_importordownloadedanswersBeingProcessed, andawaiting_approvalanswersAwaitingApproval, instead of falling through to "You have already requested this audiobook". The "already available" replies no longer name a media server.request-with-torrent: a pick is refused withAlreadyRequested("This audiobook is already being requested by another user") when another user has an open request for the book, so it can't start a second download. Failed, warn, cancelled and denied requests are ignored by this check. The approval check now usesresolveAutoApprove()(same rule as before).admin-features/request-approval.md(409 table,select-ebooksection, Fixed Issues Fix login and Plex setup flow issues #2),integrations/ebook-sidecar.md,frontend/components.md.Why
My Requests opened the book details without the request id, so a pick went down the create-new-request path and hit the duplicate check. From the admin panel the same pick went to the existing request. Ebook requests had no way through at all for non-admins, because both request-based ebook routes required an admin.
Evidence
tests/api/request-with-torrent-existing-requests.routes.test.tsfakes the request table so each query only sees the rows itswherewould match: a route that skips a check creates a request. Covers own in-flight requests by status (Fix misleading "already requested" error on in-progress downloads #291), another user's in-flight and open requests, the library wording, and that failed, cancelled and denied requests are ignored.tests/api/requests-pick-existing-request.routes.test.ts: the owner's ebook pick restarts that ebook request and creates none; another user gets 403 with nothing changed; an owner who needs approval getsawaiting_approvalwith the pick stored and no download; an admin can pick for an ebook request with no parent; a user's audiobook request id is 403 while an admin can still pick for it; a user's auto-approved pick sendsrequest_approvedand an admin's sends nothing; a deleted ebook request, a deleted audiobook request and an ebook request with a deleted parent answer 404 for owner and admin with nothing updated, created or started; the owner can run the ebook search and another user can't, and nobody can on a deleted request;select-torrentupdates the owner's audiobook request and refuses another user.RequestCardpasses id, owner and type for audiobook and ebook requests;AudiobookDetailsModalsends an ebook request to the ebook search with the request id only for an own advanceable status, and its toast followsneedsApproval.interactive-search-access.test.tsnow also covers both request-based ebook routes.main's source (f5b0543) and this branch's tests: 39 failed, 77 passed. 37 fail on assertions and 2 on a mock error: the twointeractive-search-access.test.tsrows for the request-based ebook routes fail onmainwithNo "requireAdmin" export is definedon the auth mock, because those routes were admin-only there. Of Fix misleading "already requested" error on in-progress downloads #291's own three tests, two passed onmainbecause the mock returned the row whatever the query asked for; the new fake fails onmainfor all of those statuses. On this branch: 116/116 pass.request_approved, approval toast): with the source before those fixes, 10 of the 13 new tests fail; the 3 that pass check unchanged behaviour (an admin's pick sends no notification, an admin can still pick for an audiobook request, the toast without approval).Checks
vitest relatedon the 8 changed source files, plus the new test files): PASS, 29 files, 313/313; after the review fixes,vitest relatedon the 5 files they touch plus their tests: PASS, 19 files, 199/199tsc --noEmitclean; ESLint finds nothing new in the touched files compared withmain, and the two new test files are clean)rmab-e2e/t48:2474b87, and after the review fixesrmab-e2e/t61:07ff88c): PASS, 1/1 eachmain(dad0daf):vitest relatedon the source changed on both sides: 115 files, 1490 passed and 3 timed out under load in two page tests this change does not touch; those two files alone: PASS, 14/14.tsc --noEmitcleanRisk and rollback
request_approvedwhen it skips approval. Admin behaviour is unchanged (no approval, no notification).request-with-torrentrefuses more picks: in-flight requests and another user's open request. A plain request already refused another user's open request. One difference: the pick ignores another user'sdeniedrequest, while a plain request still counts it.pendingebook request can race the automatic search already queued for it: that search setssearchingwithout a status check, so it can overwriteawaiting_approvalor start a second download. Same race as the shipped audiobookpendingrouting and the admin path onmain; not changed here.Release note
🤖 Generated with Claude Code