feat(ui): add UIAppendRemixers option to hide remixers from the Artist column (#6504)

This commit is contained in:
Deluan Quintão 2026-11-18 11:08:13 -05:00 committed by GitHub
parent ebdf2dc693
commit 6789f278c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 55 additions and 2 deletions

View File

@ -102,6 +102,7 @@ type Options struct {
DefaultUIVolume int
UISearchDebounceMs int
UICoverArtSize int
UIAppendRemixers bool // Whether to show remixers after the track artists in the UI
EnableReplayGain bool
EnableCoverAnimation bool
EnableNowPlaying bool
@ -1020,6 +1021,7 @@ func setViperDefaults() {
viper.SetDefault("defaultuivolume", consts.DefaultUIVolume)
viper.SetDefault("uisearchdebouncems", consts.DefaultUISearchDebounceMs)
viper.SetDefault("uicoverartsize", consts.DefaultUICoverArtSize)
viper.SetDefault("uiappendremixers", true)
viper.SetDefault("enablereplaygain", true)
viper.SetDefault("enablecoveranimation", true)
viper.SetDefault("enablenowplaying", true)

View File

@ -57,6 +57,7 @@ func serveIndex(ds model.DataStore, fs fs.FS, shareInfo *model.Share) http.Handl
"defaultUIVolume": conf.Server().DefaultUIVolume,
"uiSearchDebounceMs": conf.Server().UISearchDebounceMs,
"uiCoverArtSize": conf.Server().UICoverArtSize,
"uiAppendRemixers": conf.Server().UIAppendRemixers,
"enableCoverAnimation": conf.Server().EnableCoverAnimation,
"pidAlbum": conf.Server().PID.Album,
"pidTrack": conf.Server().PID.Track,

View File

@ -85,6 +85,7 @@ var _ = Describe("serveIndex", func() {
Entry("defaultUIVolume", func(c *conf.Options) { c.DefaultUIVolume = 45 }, "defaultUIVolume", float64(45)),
Entry("uiSearchDebounceMs", func(c *conf.Options) { c.UISearchDebounceMs = 500 }, "uiSearchDebounceMs", float64(500)),
Entry("uiCoverArtSize", func(c *conf.Options) { c.UICoverArtSize = 300 }, "uiCoverArtSize", float64(300)),
Entry("uiAppendRemixers", func(c *conf.Options) { c.UIAppendRemixers = false }, "uiAppendRemixers", false),
Entry("enableCoverAnimation", func(c *conf.Options) { c.EnableCoverAnimation = true }, "enableCoverAnimation", true),
Entry("pidAlbum", func(c *conf.Options) { c.PID.Album = "folder" }, "pidAlbum", "folder"),
Entry("pidTrack", func(c *conf.Options) { c.PID.Track = "title" }, "pidTrack", "title"),

View File

@ -6,6 +6,7 @@ import { useGetHandleArtistClick } from './useGetHandleArtistClick'
import { intersperse } from '../utils/index.js'
import { useDispatch } from 'react-redux'
import { closeExtendedInfoDialog } from '../actions/dialogs.js'
import config from '../config'
// noSSR: withWidth otherwise renders null until mounted, so the artist line pops in and grows the row.
const ALink = withWidth({ noSSR: true })((props) => {
@ -70,7 +71,9 @@ export const ArtistLinkField = ({ record, className, limit, source }) => {
// Get artists array with fallback
let artists = record?.participants?.[role] || []
const remixers =
role === 'artist' && record?.participants?.remixer
role === 'artist' &&
config.uiAppendRemixers &&
record?.participants?.remixer
? record.participants.remixer.slice(0, 2)
: []

View File

@ -1,7 +1,8 @@
import React from 'react'
import { render, screen } from '@testing-library/react'
import { describe, it, expect, beforeEach, vi } from 'vitest'
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'
import { ArtistLinkField } from './ArtistLinkField'
import config from '../config'
import { intersperse } from '../utils/index.js'
// Mock dependencies
@ -128,6 +129,50 @@ describe('ArtistLinkField', () => {
expect(links).toHaveLength(1)
expect(links[0]).toHaveTextContent('Duplicate Person')
})
describe('when uiAppendRemixers is disabled', () => {
let originalValue
beforeEach(() => {
originalValue = config.uiAppendRemixers
config.uiAppendRemixers = false
})
afterEach(() => {
config.uiAppendRemixers = originalValue
})
it('does not add remixers from participants', () => {
const record = {
participants: {
artist: [{ id: '1', name: 'Artist 1' }],
remixer: [{ id: '2', name: 'Remixer 1' }],
},
}
render(<ArtistLinkField record={record} source="artist" />)
expect(screen.getByText('Artist 1')).toBeInTheDocument()
expect(screen.queryByText('Remixer 1')).not.toBeInTheDocument()
})
it('does not add remixers after the display artist string', () => {
const record = {
artist: 'Main Artist',
participants: {
artist: [{ id: '1', name: 'Main Artist' }],
remixer: [{ id: '2', name: 'Remixer 1' }],
},
}
render(<ArtistLinkField record={record} source="artist" />)
const links = screen.getAllByRole('link')
expect(links).toHaveLength(1)
expect(links[0]).toHaveAttribute('href', '/artist/1')
expect(screen.queryByText(/•/)).not.toBeInTheDocument()
})
})
})
describe('when using parseAndReplaceArtists', () => {

View File

@ -22,6 +22,7 @@ const defaultConfig = {
defaultUIVolume: 100,
uiSearchDebounceMs: 200,
uiCoverArtSize: 600,
uiAppendRemixers: true,
enableUserEditing: true,
enableArtworkUpload: true,
enableSharing: true,