Compare commits

...

2 Commits

Author SHA1 Message Date
TheCatLady
30275450cc fix: use new SettingsBadge component 2022-08-28 23:21:59 -07:00
TheCatLady
feffccaca8 feat: add 'Hide Requested Media' setting 2022-08-28 23:21:58 -07:00
10 changed files with 58 additions and 10 deletions

View File

@@ -121,6 +121,9 @@ components:
hideAvailable: hideAvailable:
type: boolean type: boolean
example: false example: false
hideRequested:
type: boolean
example: false
partialRequestsEnabled: partialRequestsEnabled:
type: boolean type: boolean
example: false example: false

View File

@@ -25,6 +25,7 @@ export interface PublicSettingsResponse {
applicationTitle: string; applicationTitle: string;
applicationUrl: string; applicationUrl: string;
hideAvailable: boolean; hideAvailable: boolean;
hideRequested: boolean;
localLogin: boolean; localLogin: boolean;
movie4kEnabled: boolean; movie4kEnabled: boolean;
series4kEnabled: boolean; series4kEnabled: boolean;

View File

@@ -94,6 +94,7 @@ export interface MainSettings {
tv: Quota; tv: Quota;
}; };
hideAvailable: boolean; hideAvailable: boolean;
hideRequested: boolean;
localLogin: boolean; localLogin: boolean;
newPlexLogin: boolean; newPlexLogin: boolean;
region: string; region: string;
@@ -111,6 +112,7 @@ interface FullPublicSettings extends PublicSettings {
applicationTitle: string; applicationTitle: string;
applicationUrl: string; applicationUrl: string;
hideAvailable: boolean; hideAvailable: boolean;
hideRequested: boolean;
localLogin: boolean; localLogin: boolean;
movie4kEnabled: boolean; movie4kEnabled: boolean;
series4kEnabled: boolean; series4kEnabled: boolean;
@@ -287,6 +289,7 @@ class Settings {
tv: {}, tv: {},
}, },
hideAvailable: false, hideAvailable: false,
hideRequested: false,
localLogin: true, localLogin: true,
newPlexLogin: true, newPlexLogin: true,
region: '', region: '',
@@ -479,6 +482,7 @@ class Settings {
applicationTitle: this.data.main.applicationTitle, applicationTitle: this.data.main.applicationTitle,
applicationUrl: this.data.main.applicationUrl, applicationUrl: this.data.main.applicationUrl,
hideAvailable: this.data.main.hideAvailable, hideAvailable: this.data.main.hideAvailable,
hideRequested: this.data.main.hideRequested,
localLogin: this.data.main.localLogin, localLogin: this.data.main.localLogin,
movie4kEnabled: this.data.radarr.some( movie4kEnabled: this.data.radarr.some(
(radarr) => radarr.is4k && radarr.isDefault (radarr) => radarr.is4k && radarr.isDefault

View File

@@ -55,12 +55,18 @@ const MediaSlider = ({
[] as (MovieResult | TvResult | PersonResult)[] [] as (MovieResult | TvResult | PersonResult)[]
); );
if (settings.currentSettings.hideAvailable) { if (
settings.currentSettings.hideAvailable ||
settings.currentSettings.hideRequested
) {
titles = titles.filter( titles = titles.filter(
(i) => (i) =>
(i.mediaType === 'movie' || i.mediaType === 'tv') && i.mediaType === 'person' ||
i.mediaInfo?.status !== MediaStatus.AVAILABLE && (i.mediaInfo?.status !== MediaStatus.AVAILABLE &&
i.mediaInfo?.status !== MediaStatus.PARTIALLY_AVAILABLE i.mediaInfo?.status !== MediaStatus.PARTIALLY_AVAILABLE &&
(!settings.currentSettings.hideRequested ||
(i.mediaInfo?.status !== MediaStatus.PENDING &&
i.mediaInfo?.status !== MediaStatus.PROCESSING)))
); );
} }

View File

@@ -33,7 +33,7 @@ const Search = () => {
{ {
query: router.query.query, query: router.query.query,
}, },
{ hideAvailable: false } { hideAvailableOrRequested: true }
); );
if (error) { if (error) {

View File

@@ -40,6 +40,7 @@ const messages = defineMessages({
toastSettingsSuccess: 'Settings saved successfully!', toastSettingsSuccess: 'Settings saved successfully!',
toastSettingsFailure: 'Something went wrong while saving settings.', toastSettingsFailure: 'Something went wrong while saving settings.',
hideAvailable: 'Hide Available Media', hideAvailable: 'Hide Available Media',
hideRequested: 'Hide Requested Media',
csrfProtection: 'Enable CSRF Protection', csrfProtection: 'Enable CSRF Protection',
csrfProtectionTip: 'Set external API access to read-only (requires HTTPS)', csrfProtectionTip: 'Set external API access to read-only (requires HTTPS)',
csrfProtectionHoverTip: csrfProtectionHoverTip:
@@ -128,6 +129,7 @@ const SettingsMain = () => {
applicationUrl: data?.applicationUrl, applicationUrl: data?.applicationUrl,
csrfProtection: data?.csrfProtection, csrfProtection: data?.csrfProtection,
hideAvailable: data?.hideAvailable, hideAvailable: data?.hideAvailable,
hideRequested: data?.hideRequested,
locale: data?.locale ?? 'en', locale: data?.locale ?? 'en',
region: data?.region, region: data?.region,
originalLanguage: data?.originalLanguage, originalLanguage: data?.originalLanguage,
@@ -144,6 +146,7 @@ const SettingsMain = () => {
applicationUrl: values.applicationUrl, applicationUrl: values.applicationUrl,
csrfProtection: values.csrfProtection, csrfProtection: values.csrfProtection,
hideAvailable: values.hideAvailable, hideAvailable: values.hideAvailable,
hideRequested: values.hideRequested,
locale: values.locale, locale: values.locale,
region: values.region, region: values.region,
originalLanguage: values.originalLanguage, originalLanguage: values.originalLanguage,
@@ -398,12 +401,33 @@ const SettingsMain = () => {
type="checkbox" type="checkbox"
id="hideAvailable" id="hideAvailable"
name="hideAvailable" name="hideAvailable"
checked={values.hideAvailable || values.hideRequested}
disabled={values.hideRequested}
className={values.hideRequested ? 'opacity-50' : ''}
onChange={() => { onChange={() => {
setFieldValue('hideAvailable', !values.hideAvailable); setFieldValue('hideAvailable', !values.hideAvailable);
}} }}
/> />
</div> </div>
</div> </div>
<div className="form-row">
<label htmlFor="hideRequested" className="checkbox-label">
<span className="mr-2">
{intl.formatMessage(messages.hideRequested)}
</span>
<SettingsBadge badgeType="experimental" />
</label>
<div className="form-input">
<Field
type="checkbox"
id="hideRequested"
name="hideRequested"
onChange={() => {
setFieldValue('hideRequested', !values.hideRequested);
}}
/>
</div>
</div>
<div className="form-row"> <div className="form-row">
<label <label
htmlFor="partialRequestsEnabled" htmlFor="partialRequestsEnabled"

View File

@@ -12,6 +12,7 @@ const defaultSettings = {
applicationTitle: 'Overseerr', applicationTitle: 'Overseerr',
applicationUrl: '', applicationUrl: '',
hideAvailable: false, hideAvailable: false,
hideRequested: false,
localLogin: true, localLogin: true,
movie4kEnabled: false, movie4kEnabled: false,
series4kEnabled: false, series4kEnabled: false,

View File

@@ -30,7 +30,7 @@ interface DiscoverResult<T, S> {
const useDiscover = <T extends BaseMedia, S = Record<string, never>>( const useDiscover = <T extends BaseMedia, S = Record<string, never>>(
endpoint: string, endpoint: string,
options?: Record<string, unknown>, options?: Record<string, unknown>,
{ hideAvailable = true } = {} { hideAvailableOrRequested = true } = {}
): DiscoverResult<T, S> => { ): DiscoverResult<T, S> => {
const settings = useSettings(); const settings = useSettings();
const { data, error, size, setSize, isValidating } = useSWRInfinite< const { data, error, size, setSize, isValidating } = useSWRInfinite<
@@ -71,12 +71,19 @@ const useDiscover = <T extends BaseMedia, S = Record<string, never>>(
let titles = (data ?? []).reduce((a, v) => [...a, ...v.results], [] as T[]); let titles = (data ?? []).reduce((a, v) => [...a, ...v.results], [] as T[]);
if (settings.currentSettings.hideAvailable && hideAvailable) { if (
hideAvailableOrRequested &&
(settings.currentSettings.hideAvailable ||
settings.currentSettings.hideRequested)
) {
titles = titles.filter( titles = titles.filter(
(i) => (i) =>
(i.mediaType === 'movie' || i.mediaType === 'tv') && i.mediaType === 'person' ||
i.mediaInfo?.status !== MediaStatus.AVAILABLE && (i.mediaInfo?.status !== MediaStatus.AVAILABLE &&
i.mediaInfo?.status !== MediaStatus.PARTIALLY_AVAILABLE i.mediaInfo?.status !== MediaStatus.PARTIALLY_AVAILABLE &&
(!settings.currentSettings.hideRequested ||
(i.mediaInfo?.status !== MediaStatus.PENDING &&
i.mediaInfo?.status !== MediaStatus.PROCESSING)))
); );
} }

View File

@@ -773,6 +773,7 @@
"components.Settings.generalsettings": "General Settings", "components.Settings.generalsettings": "General Settings",
"components.Settings.generalsettingsDescription": "Configure global and default settings for Overseerr.", "components.Settings.generalsettingsDescription": "Configure global and default settings for Overseerr.",
"components.Settings.hideAvailable": "Hide Available Media", "components.Settings.hideAvailable": "Hide Available Media",
"components.Settings.hideRequested": "Hide Requested Media",
"components.Settings.hostname": "Hostname or IP Address", "components.Settings.hostname": "Hostname or IP Address",
"components.Settings.is4k": "4K", "components.Settings.is4k": "4K",
"components.Settings.librariesRemaining": "Libraries Remaining: {count}", "components.Settings.librariesRemaining": "Libraries Remaining: {count}",

View File

@@ -170,6 +170,7 @@ CoreApp.getInitialProps = async (initialProps) => {
applicationTitle: '', applicationTitle: '',
applicationUrl: '', applicationUrl: '',
hideAvailable: false, hideAvailable: false,
hideRequested: false,
movie4kEnabled: false, movie4kEnabled: false,
series4kEnabled: false, series4kEnabled: false,
localLogin: true, localLogin: true,