[bugfix]: fix smart playlist, do not error when trying to edit playlist as non-admin
This commit is contained in:
parent
44fcc33825
commit
6bc778fa53
3 changed files with 14 additions and 12 deletions
|
@ -1,6 +1,6 @@
|
|||
import { ndApiClient } from '/@/renderer/api/navidrome/navidrome-api';
|
||||
import { ndNormalize } from '/@/renderer/api/navidrome/navidrome-normalize';
|
||||
import { NavidromeExtensions, ndType } from '/@/renderer/api/navidrome/navidrome-types';
|
||||
import { ndType } from '/@/renderer/api/navidrome/navidrome-types';
|
||||
import { ssApiClient } from '/@/renderer/api/subsonic/subsonic-api';
|
||||
import semverCoerce from 'semver/functions/coerce';
|
||||
import semverGte from 'semver/functions/gte';
|
||||
|
@ -541,7 +541,7 @@ const getServerInfo = async (args: ServerInfoArgs): Promise<ServerInfo> => {
|
|||
|
||||
const features: ServerFeatures = {
|
||||
lyricsMultipleStructured: !!navidromeFeatures[SubsonicExtensions.SONG_LYRICS],
|
||||
playlistsSmart: !!navidromeFeatures[NavidromeExtensions.SMART_PLAYLISTS],
|
||||
playlistsSmart: !!navidromeFeatures[ServerFeature.PLAYLISTS_SMART],
|
||||
};
|
||||
|
||||
return { features, id: apiClientProps.server?.id, version: ping.body.serverVersion! };
|
||||
|
|
|
@ -343,10 +343,6 @@ const removeFromPlaylistParameters = z.object({
|
|||
id: z.array(z.string()),
|
||||
});
|
||||
|
||||
export enum NavidromeExtensions {
|
||||
SMART_PLAYLISTS = 'smartPlaylists',
|
||||
}
|
||||
|
||||
export const ndType = {
|
||||
_enum: {
|
||||
albumArtistList: ndAlbumArtistListSort,
|
||||
|
|
|
@ -76,7 +76,7 @@ export const UpdatePlaylistForm = ({ users, query, body, onCancel }: UpdatePlayl
|
|||
});
|
||||
|
||||
const isPublicDisplayed = server?.type === ServerType.NAVIDROME;
|
||||
const isOwnerDisplayed = server?.type === ServerType.NAVIDROME;
|
||||
const isOwnerDisplayed = server?.type === ServerType.NAVIDROME && userList;
|
||||
const isSubmitDisabled = !form.values.name || mutation.isLoading;
|
||||
|
||||
return (
|
||||
|
@ -154,11 +154,17 @@ export const openUpdatePlaylistModal = async (args: {
|
|||
|
||||
const users =
|
||||
server?.type === ServerType.NAVIDROME
|
||||
? await queryClient.fetchQuery({
|
||||
? await queryClient
|
||||
.fetchQuery({
|
||||
queryFn: ({ signal }) =>
|
||||
api.controller.getUserList({ apiClientProps: { server, signal }, query }),
|
||||
queryKey: queryKeys.users.list(server?.id || '', query),
|
||||
})
|
||||
.catch((error) => {
|
||||
// This eror most likely happens if the user is not an admin
|
||||
console.error(error);
|
||||
return null;
|
||||
})
|
||||
: null;
|
||||
|
||||
openModal({
|
||||
|
|
Reference in a new issue