Set owner field edit to Navidrome only (#327)

This commit is contained in:
jeffvli 2023-10-26 16:42:21 -07:00
parent 3c2e4d40ec
commit ac84088c69

View file

@ -71,6 +71,7 @@ export const UpdatePlaylistForm = ({ users, query, body, onCancel }: UpdatePlayl
}); });
const isPublicDisplayed = server?.type === ServerType.NAVIDROME; const isPublicDisplayed = server?.type === ServerType.NAVIDROME;
const isOwnerDisplayed = server?.type === ServerType.NAVIDROME;
const isSubmitDisabled = !form.values.name || mutation.isLoading; const isSubmitDisabled = !form.values.name || mutation.isLoading;
return ( return (
@ -86,11 +87,13 @@ export const UpdatePlaylistForm = ({ users, query, body, onCancel }: UpdatePlayl
label="Description" label="Description"
{...form.getInputProps('comment')} {...form.getInputProps('comment')}
/> />
<Select {isOwnerDisplayed && (
data={userList || []} <Select
{...form.getInputProps('_custom.navidrome.ownerId')} data={userList || []}
label="Owner" {...form.getInputProps('_custom.navidrome.ownerId')}
/> label="Owner"
/>
)}
{isPublicDisplayed && ( {isPublicDisplayed && (
<Switch <Switch
label="Is Public?" label="Is Public?"
@ -132,11 +135,14 @@ export const openUpdatePlaylistModal = async (args: {
if (!server) return; if (!server) return;
const users = await queryClient.fetchQuery({ const users =
queryFn: ({ signal }) => server?.type === ServerType.NAVIDROME
api.controller.getUserList({ apiClientProps: { server, signal }, query }), ? await queryClient.fetchQuery({
queryKey: queryKeys.users.list(server?.id || '', query), queryFn: ({ signal }) =>
}); api.controller.getUserList({ apiClientProps: { server, signal }, query }),
queryKey: queryKeys.users.list(server?.id || '', query),
})
: null;
openModal({ openModal({
children: ( children: (