feat(email validation): email requirement and validation + better importer

This commit is contained in:
Nicolai Van der Storm
2022-06-13 14:21:05 +02:00
parent cc69f66ba9
commit d835336d33
6 changed files with 78 additions and 59 deletions

View File

@@ -5,7 +5,7 @@ import { useUser } from '../../hooks/useUser';
import PlexLoginButton from '../PlexLoginButton';
const messages = defineMessages({
welcome: 'Welcome to Overseerr',
welcome: 'Welcome to Jellyseerr',
signinMessage: 'Get started by signing in with your Plex account',
});

View File

@@ -9,7 +9,7 @@ import { MediaServerType } from '../../../server/constants/server';
import getConfig from 'next/config';
const messages = defineMessages({
welcome: 'Welcome to Overseerr',
welcome: 'Welcome to Jellyseerr',
signinMessage: 'Get started by signing in',
signinWithJellyfin: 'Use your {mediaServerName} account',
signinWithPlex: 'Use your Plex account',

View File

@@ -9,6 +9,7 @@ import globalMessages from '../../i18n/globalMessages';
import Alert from '../Common/Alert';
import Modal from '../Common/Modal';
import getConfig from 'next/config';
import { UserResultsResponse } from '../../../server/interfaces/api/userInterfaces';
interface JellyfinImportProps {
onCancel?: () => void;
@@ -30,6 +31,7 @@ const messages = defineMessages({
const JellyfinImportModal: React.FC<JellyfinImportProps> = ({
onCancel,
onComplete,
children,
}) => {
const intl = useIntl();
const settings = useSettings();
@@ -117,6 +119,20 @@ const JellyfinImportModal: React.FC<JellyfinImportProps> = ({
}
};
const { data: existingUsers } = useSWR<UserResultsResponse>(
`/api/v1/user?take=${children}`
);
data?.forEach((user, pos) => {
if (
existingUsers?.results.some(
(existingUser) => existingUser.jellyfinUserId === user.id
)
) {
delete data[pos];
}
});
return (
<Modal
loading={!data && !error}

View File

@@ -482,7 +482,9 @@ const UserList: React.FC = () => {
setShowImportModal(false);
revalidate();
}}
/>
>
{data.pageInfo.results}
</JellyfinImportModal>
)}
</Transition>