-
-
Notifications
You must be signed in to change notification settings - Fork 912
feat(settings): hide already requested media #1855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
86f5ea9
2db9239
ed467b7
d63dfd6
cfeeb8c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -82,6 +82,21 @@ const MediaSlider = ({ | |||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| if (settings.currentSettings.hideRequested) { | ||||||||||||||||||||||||||||||||||||||
| titles = titles.filter((i) => { | ||||||||||||||||||||||||||||||||||||||
| if (i.mediaType !== 'movie' && i.mediaType !== 'tv') { | ||||||||||||||||||||||||||||||||||||||
| return true; | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||
| i.mediaInfo?.status === MediaStatus.AVAILABLE || | ||||||||||||||||||||||||||||||||||||||
| i.mediaInfo?.status === MediaStatus.PARTIALLY_AVAILABLE || | ||||||||||||||||||||||||||||||||||||||
| !i.mediaInfo?.requests || | ||||||||||||||||||||||||||||||||||||||
| i.mediaInfo.requests.length === 0 | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+91
to
+95
|
||||||||||||||||||||||||||||||||||||||
| return ( | |
| i.mediaInfo?.status === MediaStatus.AVAILABLE || | |
| i.mediaInfo?.status === MediaStatus.PARTIALLY_AVAILABLE || | |
| !i.mediaInfo?.requests || | |
| i.mediaInfo.requests.length === 0 | |
| const hasActiveRequests = | |
| !!i.mediaInfo?.requests && | |
| i.mediaInfo.requests.some( | |
| (request) => | |
| request.status !== 'DECLINED' && | |
| request.status !== 'COMPLETED' && | |
| request.status !== 'FAILED' | |
| ); | |
| return ( | |
| i.mediaInfo?.status === MediaStatus.AVAILABLE || | |
| i.mediaInfo?.status === MediaStatus.PARTIALLY_AVAILABLE || | |
| !hasActiveRequests |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -15,6 +15,7 @@ interface BaseMedia { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mediaType: string; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mediaInfo?: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| status: MediaStatus; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| requests?: unknown[]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -54,7 +55,7 @@ const useDiscover = < | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| >( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| endpoint: string, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| options?: O, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { hideAvailable = true, hideBlocklisted = true } = {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { hideAvailable = true, hideBlocklisted = true, hideRequested = true } = {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ): DiscoverResult<T, S> => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const settings = useSettings(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { hasPermission } = useUser(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -136,6 +137,17 @@ const useDiscover = < | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (settings.currentSettings.hideRequested && hideRequested) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| titles = titles.filter( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (i) => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (i.mediaType === 'movie' || i.mediaType === 'tv') && | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (i.mediaInfo?.status === MediaStatus.AVAILABLE || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| i.mediaInfo?.status === MediaStatus.PARTIALLY_AVAILABLE || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| !i.mediaInfo?.requests || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| i.mediaInfo.requests.length === 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+141
to
+148
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| titles = titles.filter( | |
| (i) => | |
| (i.mediaType === 'movie' || i.mediaType === 'tv') && | |
| (i.mediaInfo?.status === MediaStatus.AVAILABLE || | |
| i.mediaInfo?.status === MediaStatus.PARTIALLY_AVAILABLE || | |
| !i.mediaInfo?.requests || | |
| i.mediaInfo.requests.length === 0) | |
| ); | |
| titles = titles.filter((i) => { | |
| // Preserve non-movie/TV results (e.g. people), and only apply | |
| // the requested/availability checks to movie and TV items. | |
| if (i.mediaType !== 'movie' && i.mediaType !== 'tv') { | |
| return true; | |
| } | |
| return ( | |
| i.mediaInfo?.status === MediaStatus.AVAILABLE || | |
| i.mediaInfo?.status === MediaStatus.PARTIALLY_AVAILABLE || | |
| !i.mediaInfo?.requests || | |
| i.mediaInfo.requests.length === 0 | |
| ); | |
| }); |
Copilot
AI
Mar 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hideRequested treats any existing request record as "requested" (requests.length > 0), which will also hide items that only have DECLINED (and potentially COMPLETED/FAILED) historical requests. Consider filtering requests by status (e.g., exclude DECLINED/COMPLETED) or basing this on mediaInfo.status so only actively-requested items are hidden.
| titles = titles.filter( | |
| (i) => | |
| (i.mediaType === 'movie' || i.mediaType === 'tv') && | |
| (i.mediaInfo?.status === MediaStatus.AVAILABLE || | |
| i.mediaInfo?.status === MediaStatus.PARTIALLY_AVAILABLE || | |
| !i.mediaInfo?.requests || | |
| i.mediaInfo.requests.length === 0) | |
| ); | |
| titles = titles.filter((i) => { | |
| // Only consider movies and TV shows for hideRequested; keep others. | |
| if (i.mediaType !== 'movie' && i.mediaType !== 'tv') { | |
| return true; | |
| } | |
| const status = i.mediaInfo?.status; | |
| // Hide only items that are actively requested (e.g., pending or processing). | |
| // Items with only historical (declined/completed) requests will not be hidden. | |
| return ( | |
| status !== MediaStatus.PENDING && | |
| status !== MediaStatus.PROCESSING | |
| ); | |
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding
leftJoinAndSelect('media.requests', 'requests')ingetRelatedMediawill load fullMediaRequestentities for every discover/search result. BecauseMediaRequesthas eager relations (e.g.requestedBy,modifiedBy,seasons), this can significantly increase payload size and may expose requester user details in endpoints that previously only returnedmediaInfo.status. Consider returning a lightweight signal instead (e.g., relation count / existence of non-declined/non-completed requests vialoadRelationCountAndMap, or a subquery that selects only request IDs/statuses) rather than selecting the full relation.