mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Backport pull request #5661 from jellyfin-web/release-10.9.z
Use display missing episodes setting in search
Original-merge: 2a110f6b5d
Merged-by: thornbill <thornbill@users.noreply.github.com>
Backported-by: Joshua M. Boniface <joshua@boniface.me>
This commit is contained in:
parent
0e07d8a19a
commit
1688829caf
1 changed files with 26 additions and 9 deletions
|
@ -1,4 +1,5 @@
|
||||||
import type { BaseItemDto, BaseItemDtoQueryResult } from '@jellyfin/sdk/lib/generated-client';
|
import type { BaseItemDto, BaseItemDtoQueryResult } from '@jellyfin/sdk/lib/generated-client';
|
||||||
|
import { BaseItemKind } from '@jellyfin/sdk/lib/generated-client/models/base-item-kind';
|
||||||
import type { ApiClient } from 'jellyfin-apiclient';
|
import type { ApiClient } from 'jellyfin-apiclient';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import React, { type FC, useCallback, useEffect, useState } from 'react';
|
import React, { type FC, useCallback, useEffect, useState } from 'react';
|
||||||
|
@ -77,16 +78,32 @@ const SearchResults: FC<SearchResultsProps> = ({ serverId = window.ApiClient.ser
|
||||||
).then(ensureNonNullItems)
|
).then(ensureNonNullItems)
|
||||||
), [getDefaultParameters]);
|
), [getDefaultParameters]);
|
||||||
|
|
||||||
const fetchItems = useCallback((apiClient: ApiClient, params = {}) => (
|
const fetchItems = useCallback(async (apiClient?: ApiClient, params = {}) => {
|
||||||
apiClient?.getItems(
|
if (!apiClient) {
|
||||||
apiClient.getCurrentUserId(),
|
console.error('[SearchResults] no apiClient; unable to fetch items');
|
||||||
{
|
return {
|
||||||
...getDefaultParameters(),
|
Items: []
|
||||||
IncludeMedia: true,
|
};
|
||||||
...params
|
}
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
...getDefaultParameters(),
|
||||||
|
IncludeMedia: true,
|
||||||
|
...params
|
||||||
|
};
|
||||||
|
|
||||||
|
if (params.IncludeItemTypes === BaseItemKind.Episode) {
|
||||||
|
const user = await apiClient.getCurrentUser();
|
||||||
|
if (!user?.Configuration?.DisplayMissingEpisodes) {
|
||||||
|
options.IsMissing = false;
|
||||||
}
|
}
|
||||||
).then(ensureNonNullItems)
|
}
|
||||||
), [getDefaultParameters]);
|
|
||||||
|
return apiClient.getItems(
|
||||||
|
apiClient.getCurrentUserId(),
|
||||||
|
options
|
||||||
|
).then(ensureNonNullItems);
|
||||||
|
}, [getDefaultParameters]);
|
||||||
|
|
||||||
const fetchPeople = useCallback((apiClient: ApiClient, params = {}) => (
|
const fetchPeople = useCallback((apiClient: ApiClient, params = {}) => (
|
||||||
apiClient?.getPeople(
|
apiClient?.getPeople(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue