mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-15 14:48:41 +01:00
feat: add configurable visibility control for NowPlaying feature
Replaces the boolean EnableNowPlaying option with a more flexible NowPlaying configuration structure containing Enabled and AdminOnly flags. This allows three visibility modes: disabled, admin-only, and all users. The new configuration uses nowplayingOptions struct similar to jukeboxOptions, with the following defaults: - NowPlaying.Enabled: true (feature enabled) - NowPlaying.AdminOnly: false (visible to all users) The old EnableNowPlaying option is deprecated and automatically migrated to NowPlaying.Enabled with a warning message. Frontend changes update the AppBar component to conditionally render NowPlayingPanel based on both the enabled state and the admin-only permission check. Server-side enforcement of the AdminOnly setting is added in a follow-up commit. Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
parent
05105e91d9
commit
08e632d918
9 changed files with 36 additions and 12 deletions
|
|
@ -34,6 +34,7 @@ const defaultConfig = {
|
|||
enableCoverAnimation: true,
|
||||
enableNowPlaying: true,
|
||||
playbackReportIntervalMs: 60000,
|
||||
nowPlayingAdminOnly: false,
|
||||
devShowArtistPage: true,
|
||||
devUIShowConfig: true,
|
||||
devNewEventStream: false,
|
||||
|
|
|
|||
|
|
@ -121,8 +121,10 @@ const CustomUserMenu = ({ onClick, ...rest }) => {
|
|||
return (
|
||||
<>
|
||||
{config.devActivityPanel &&
|
||||
permissions === 'admin' &&
|
||||
config.enableNowPlaying && <NowPlayingPanel />}
|
||||
config.enableNowPlaying &&
|
||||
(!config.nowPlayingAdminOnly || permissions === 'admin') && (
|
||||
<NowPlayingPanel />
|
||||
)}
|
||||
{config.devActivityPanel && permissions === 'admin' && <ActivityPanel />}
|
||||
<UserMenu {...rest}>
|
||||
<PersonalMenu sidebarIsOpen={true} onClick={onClick} />
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ describe('<AppBar />', () => {
|
|||
beforeEach(() => {
|
||||
config.devActivityPanel = true
|
||||
config.enableNowPlaying = true
|
||||
config.nowPlayingAdminOnly = true
|
||||
store = createStore(combineReducers({ activity: activityReducer }), {
|
||||
activity: { nowPlayingCount: 0 },
|
||||
})
|
||||
|
|
@ -62,4 +63,14 @@ describe('<AppBar />', () => {
|
|||
)
|
||||
expect(screen.queryByTestId('now-playing-panel')).toBeNull()
|
||||
})
|
||||
|
||||
it('shows NowPlayingPanel to all users when adminOnly is false', () => {
|
||||
config.nowPlayingAdminOnly = false
|
||||
render(
|
||||
<Provider store={store}>
|
||||
<AppBar />
|
||||
</Provider>,
|
||||
)
|
||||
expect(screen.getByTestId('now-playing-panel')).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue