mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-24 07:30:57 +03:00
Don't allow adding songs to smart playlists
This commit is contained in:
parent
552989a05b
commit
3d5a1cef92
persistence
ui/src/dialogs
@ -32,7 +32,8 @@ func NewPlaylistRepository(ctx context.Context, o orm.QueryExecutor) model.Playl
|
||||
r.ormer = o
|
||||
r.tableName = "playlist"
|
||||
r.filterMappings = map[string]filterFunc{
|
||||
"q": playlistFilter,
|
||||
"q": playlistFilter,
|
||||
"smart": smartPlaylistFilter,
|
||||
}
|
||||
return r
|
||||
}
|
||||
@ -44,6 +45,10 @@ func playlistFilter(field string, value interface{}) Sqlizer {
|
||||
}
|
||||
}
|
||||
|
||||
func smartPlaylistFilter(field string, value interface{}) Sqlizer {
|
||||
return Eq{"rules": ""}
|
||||
}
|
||||
|
||||
func (r *playlistRepository) userFilter() Sqlizer {
|
||||
user := loggedUser(r.ctx)
|
||||
if user.IsAdmin {
|
||||
|
@ -45,7 +45,7 @@ const createTestUtils = (mockDataProvider) =>
|
||||
data: mockIndexedData,
|
||||
list: {
|
||||
cachedRequests: {
|
||||
'{"pagination":{"page":1,"perPage":-1},"sort":{"field":"name","order":"ASC"},"filter":{}}':
|
||||
'{"pagination":{"page":1,"perPage":-1},"sort":{"field":"name","order":"ASC"},"filter":{"smart":false}}':
|
||||
{
|
||||
ids: ['sample-id1', 'sample-id2'],
|
||||
total: 2,
|
||||
|
@ -25,7 +25,7 @@ export const SelectPlaylistInput = ({ onChange }) => {
|
||||
'playlist',
|
||||
{ page: 1, perPage: -1 },
|
||||
{ field: 'name', order: 'ASC' },
|
||||
{}
|
||||
{ smart: false }
|
||||
)
|
||||
|
||||
const options =
|
||||
|
@ -51,7 +51,7 @@ describe('SelectPlaylistInput', () => {
|
||||
data: mockIndexedData,
|
||||
list: {
|
||||
cachedRequests: {
|
||||
'{"pagination":{"page":1,"perPage":-1},"sort":{"field":"name","order":"ASC"},"filter":{}}':
|
||||
'{"pagination":{"page":1,"perPage":-1},"sort":{"field":"name","order":"ASC"},"filter":{"smart":false}}':
|
||||
{
|
||||
ids: ['sample-id1', 'sample-id2'],
|
||||
total: 2,
|
||||
@ -70,7 +70,7 @@ describe('SelectPlaylistInput', () => {
|
||||
|
||||
await waitFor(() => {
|
||||
expect(mockDataProvider.getList).toHaveBeenCalledWith('playlist', {
|
||||
filter: {},
|
||||
filter: { smart: false },
|
||||
pagination: { page: 1, perPage: -1 },
|
||||
sort: { field: 'name', order: 'ASC' },
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user