navidrome/ui/src/common/playlistUtils.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

15 lines
372 B
JavaScript
Raw Normal View History

2021-10-29 22:55:28 -04:00
export const isWritable = (ownerId) => {
2020-06-05 10:22:31 -04:00
return (
2021-10-29 22:55:28 -04:00
localStorage.getItem('userId') === ownerId ||
2020-06-05 10:22:31 -04:00
localStorage.getItem('role') === 'admin'
)
}
2021-10-29 22:55:28 -04:00
export const isReadOnly = (ownerId) => {
return !isWritable(ownerId)
2020-06-05 10:22:31 -04:00
}
2021-10-22 21:11:44 -04:00
export const isSmartPlaylist = (pls) => !!pls.rules
export const canChangeTracks = (pls) =>
2021-10-29 22:55:28 -04:00
isWritable(pls.ownerId) && !isSmartPlaylist(pls)