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')}
/> />
{isOwnerDisplayed && (
<Select <Select
data={userList || []} data={userList || []}
{...form.getInputProps('_custom.navidrome.ownerId')} {...form.getInputProps('_custom.navidrome.ownerId')}
label="Owner" 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 =
server?.type === ServerType.NAVIDROME
? await queryClient.fetchQuery({
queryFn: ({ signal }) => queryFn: ({ signal }) =>
api.controller.getUserList({ apiClientProps: { server, signal }, query }), api.controller.getUserList({ apiClientProps: { server, signal }, query }),
queryKey: queryKeys.users.list(server?.id || '', query), queryKey: queryKeys.users.list(server?.id || '', query),
}); })
: null;
openModal({ openModal({
children: ( children: (