mirror of
https://github.com/sct/overseerr.git
synced 2025-12-27 00:34:56 +01:00
Merge remote-tracking branch 'upstream/develop' into develop
This commit is contained in:
@@ -76,8 +76,12 @@ const RegionSelector = ({
|
||||
}, [value, regions, allRegion]);
|
||||
|
||||
useEffect(() => {
|
||||
if (onChange && regions && selectedRegion) {
|
||||
onChange(name, selectedRegion.iso_3166_1);
|
||||
if (onChange && regions) {
|
||||
if (selectedRegion) {
|
||||
onChange(name, selectedRegion.iso_3166_1);
|
||||
} else {
|
||||
onChange(name, '');
|
||||
}
|
||||
}
|
||||
}, [onChange, selectedRegion, name, regions]);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import LoadingSpinner from '@app/components/Common/LoadingSpinner';
|
||||
import NotificationTypeSelector from '@app/components/NotificationTypeSelector';
|
||||
import globalMessages from '@app/i18n/globalMessages';
|
||||
import { ArrowDownOnSquareIcon, BeakerIcon } from '@heroicons/react/24/outline';
|
||||
import type { PushoverSound } from '@server/api/pushover';
|
||||
import axios from 'axios';
|
||||
import { Field, Form, Formik } from 'formik';
|
||||
import { useState } from 'react';
|
||||
@@ -19,6 +20,8 @@ const messages = defineMessages({
|
||||
userToken: 'User or Group Key',
|
||||
userTokenTip:
|
||||
'Your 30-character <UsersGroupsLink>user or group identifier</UsersGroupsLink>',
|
||||
sound: 'Notification Sound',
|
||||
deviceDefault: 'Device Default',
|
||||
validationAccessTokenRequired: 'You must provide a valid application token',
|
||||
validationUserTokenRequired: 'You must provide a valid user or group key',
|
||||
pushoversettingssaved: 'Pushover notification settings saved successfully!',
|
||||
@@ -38,6 +41,11 @@ const NotificationsPushover = () => {
|
||||
error,
|
||||
mutate: revalidate,
|
||||
} = useSWR('/api/v1/settings/notifications/pushover');
|
||||
const { data: soundsData } = useSWR<PushoverSound[]>(
|
||||
data?.options.accessToken
|
||||
? `/api/v1/settings/notifications/pushover/sounds?token=${data.options.accessToken}`
|
||||
: null
|
||||
);
|
||||
|
||||
const NotificationsPushoverSchema = Yup.object().shape({
|
||||
accessToken: Yup.string()
|
||||
@@ -77,6 +85,7 @@ const NotificationsPushover = () => {
|
||||
types: data?.types,
|
||||
accessToken: data?.options.accessToken,
|
||||
userToken: data?.options.userToken,
|
||||
sound: data?.options.sound,
|
||||
}}
|
||||
validationSchema={NotificationsPushoverSchema}
|
||||
onSubmit={async (values) => {
|
||||
@@ -132,6 +141,7 @@ const NotificationsPushover = () => {
|
||||
options: {
|
||||
accessToken: values.accessToken,
|
||||
userToken: values.userToken,
|
||||
sound: values.sound,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -226,6 +236,30 @@ const NotificationsPushover = () => {
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="form-row">
|
||||
<label htmlFor="sound" className="text-label">
|
||||
{intl.formatMessage(messages.sound)}
|
||||
</label>
|
||||
<div className="form-input-area">
|
||||
<div className="form-input-field">
|
||||
<Field
|
||||
as="select"
|
||||
id="sound"
|
||||
name="sound"
|
||||
disabled={!soundsData?.length}
|
||||
>
|
||||
<option value="">
|
||||
{intl.formatMessage(messages.deviceDefault)}
|
||||
</option>
|
||||
{soundsData?.map((sound, index) => (
|
||||
<option key={`sound-${index}`} value={sound.name}>
|
||||
{sound.description}
|
||||
</option>
|
||||
))}
|
||||
</Field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<NotificationTypeSelector
|
||||
currentTypes={values.enabled ? values.types : 0}
|
||||
onUpdate={(newTypes) => {
|
||||
|
||||
@@ -4,6 +4,7 @@ import NotificationTypeSelector from '@app/components/NotificationTypeSelector';
|
||||
import useSettings from '@app/hooks/useSettings';
|
||||
import { useUser } from '@app/hooks/useUser';
|
||||
import globalMessages from '@app/i18n/globalMessages';
|
||||
import type { PushoverSound } from '@server/api/pushover';
|
||||
import type { UserSettingsNotificationsResponse } from '@server/interfaces/api/userSettingsInterfaces';
|
||||
import axios from 'axios';
|
||||
import { Field, Form, Formik } from 'formik';
|
||||
@@ -22,6 +23,8 @@ const messages = defineMessages({
|
||||
pushoverUserKey: 'User or Group Key',
|
||||
pushoverUserKeyTip:
|
||||
'Your 30-character <UsersGroupsLink>user or group identifier</UsersGroupsLink>',
|
||||
sound: 'Notification Sound',
|
||||
deviceDefault: 'Device Default',
|
||||
validationPushoverApplicationToken:
|
||||
'You must provide a valid application token',
|
||||
validationPushoverUserKey: 'You must provide a valid user or group key',
|
||||
@@ -40,6 +43,11 @@ const UserPushoverSettings = () => {
|
||||
} = useSWR<UserSettingsNotificationsResponse>(
|
||||
user ? `/api/v1/user/${user?.id}/settings/notifications` : null
|
||||
);
|
||||
const { data: soundsData } = useSWR<PushoverSound[]>(
|
||||
data?.pushoverApplicationToken
|
||||
? `/api/v1/settings/notifications/pushover/sounds?token=${data.pushoverApplicationToken}`
|
||||
: null
|
||||
);
|
||||
|
||||
const UserNotificationsPushoverSchema = Yup.object().shape({
|
||||
pushoverApplicationToken: Yup.string()
|
||||
@@ -191,6 +199,30 @@ const UserPushoverSettings = () => {
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="form-row">
|
||||
<label htmlFor="sound" className="text-label">
|
||||
{intl.formatMessage(messages.sound)}
|
||||
</label>
|
||||
<div className="form-input-area">
|
||||
<div className="form-input-field">
|
||||
<Field
|
||||
as="select"
|
||||
id="sound"
|
||||
name="sound"
|
||||
disabled={!soundsData?.length}
|
||||
>
|
||||
<option value="">
|
||||
{intl.formatMessage(messages.deviceDefault)}
|
||||
</option>
|
||||
{soundsData?.map((sound, index) => (
|
||||
<option key={`sound-${index}`} value={sound.name}>
|
||||
{sound.description}
|
||||
</option>
|
||||
))}
|
||||
</Field>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<NotificationTypeSelector
|
||||
user={user}
|
||||
currentTypes={values.types}
|
||||
|
||||
@@ -584,8 +584,10 @@
|
||||
"components.Settings.Notifications.NotificationsPushover.accessToken": "Application API Token",
|
||||
"components.Settings.Notifications.NotificationsPushover.accessTokenTip": "<ApplicationRegistrationLink>Register an application</ApplicationRegistrationLink> for use with Jellyseerr",
|
||||
"components.Settings.Notifications.NotificationsPushover.agentenabled": "Enable Agent",
|
||||
"components.Settings.Notifications.NotificationsPushover.deviceDefault": "Device Default",
|
||||
"components.Settings.Notifications.NotificationsPushover.pushoversettingsfailed": "Pushover notification settings failed to save.",
|
||||
"components.Settings.Notifications.NotificationsPushover.pushoversettingssaved": "Pushover notification settings saved successfully!",
|
||||
"components.Settings.Notifications.NotificationsPushover.sound": "Notification Sound",
|
||||
"components.Settings.Notifications.NotificationsPushover.toastPushoverTestFailed": "Pushover test notification failed to send.",
|
||||
"components.Settings.Notifications.NotificationsPushover.toastPushoverTestSending": "Sending Pushover test notification…",
|
||||
"components.Settings.Notifications.NotificationsPushover.toastPushoverTestSuccess": "Pushover test notification sent!",
|
||||
@@ -1163,6 +1165,7 @@
|
||||
"components.UserProfile.UserSettings.UserGeneralSettings.toastSettingsSuccess": "Settings saved successfully!",
|
||||
"components.UserProfile.UserSettings.UserGeneralSettings.user": "User",
|
||||
"components.UserProfile.UserSettings.UserGeneralSettings.validationDiscordId": "You must provide a valid Discord user ID",
|
||||
"components.UserProfile.UserSettings.UserNotificationSettings.deviceDefault": "Device Default",
|
||||
"components.UserProfile.UserSettings.UserNotificationSettings.discordId": "User ID",
|
||||
"components.UserProfile.UserSettings.UserNotificationSettings.discordIdTip": "The <FindDiscordIdLink>multi-digit ID number</FindDiscordIdLink> associated with your user account",
|
||||
"components.UserProfile.UserSettings.UserNotificationSettings.discordsettingsfailed": "Discord notification settings failed to save.",
|
||||
@@ -1186,6 +1189,7 @@
|
||||
"components.UserProfile.UserSettings.UserNotificationSettings.pushoversettingssaved": "Pushover notification settings saved successfully!",
|
||||
"components.UserProfile.UserSettings.UserNotificationSettings.sendSilently": "Send Silently",
|
||||
"components.UserProfile.UserSettings.UserNotificationSettings.sendSilentlyDescription": "Send notifications with no sound",
|
||||
"components.UserProfile.UserSettings.UserNotificationSettings.sound": "Notification Sound",
|
||||
"components.UserProfile.UserSettings.UserNotificationSettings.telegramChatId": "Chat ID",
|
||||
"components.UserProfile.UserSettings.UserNotificationSettings.telegramChatIdTipLong": "<TelegramBotLink>Start a chat</TelegramBotLink>, add <GetIdBotLink>@get_id_bot</GetIdBotLink>, and issue the <code>/my_id</code> command",
|
||||
"components.UserProfile.UserSettings.UserNotificationSettings.telegramsettingsfailed": "Telegram notification settings failed to save.",
|
||||
|
||||
Reference in New Issue
Block a user