Skip to content

Commit

Permalink
Set owner field edit to Navidrome only (#327)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffvli committed Oct 26, 2023
1 parent 3c2e4d4 commit ac84088
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/renderer/features/playlists/components/update-playlist-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export const UpdatePlaylistForm = ({ users, query, body, onCancel }: UpdatePlayl
});

const isPublicDisplayed = server?.type === ServerType.NAVIDROME;
const isOwnerDisplayed = server?.type === ServerType.NAVIDROME;
const isSubmitDisabled = !form.values.name || mutation.isLoading;

return (
Expand All @@ -86,11 +87,13 @@ export const UpdatePlaylistForm = ({ users, query, body, onCancel }: UpdatePlayl
label="Description"
{...form.getInputProps('comment')}
/>
<Select
data={userList || []}
{...form.getInputProps('_custom.navidrome.ownerId')}
label="Owner"
/>
{isOwnerDisplayed && (
<Select
data={userList || []}
{...form.getInputProps('_custom.navidrome.ownerId')}
label="Owner"
/>
)}
{isPublicDisplayed && (
<Switch
label="Is Public?"
Expand Down Expand Up @@ -132,11 +135,14 @@ export const openUpdatePlaylistModal = async (args: {

if (!server) return;

const users = await queryClient.fetchQuery({
queryFn: ({ signal }) =>
api.controller.getUserList({ apiClientProps: { server, signal }, query }),
queryKey: queryKeys.users.list(server?.id || '', query),
});
const users =
server?.type === ServerType.NAVIDROME
? await queryClient.fetchQuery({
queryFn: ({ signal }) =>
api.controller.getUserList({ apiClientProps: { server, signal }, query }),
queryKey: queryKeys.users.list(server?.id || '', query),
})
: null;

openModal({
children: (
Expand Down

1 comment on commit ac84088

@vercel
Copy link

@vercel vercel bot commented on ac84088 Oct 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

feishin – ./

feishin.vercel.app
feishin-git-development-jeffvli.vercel.app
feishin-jeffvli.vercel.app

Please sign in to comment.