From 6789f278c463c7f5d438d073b880ce1da76fe7c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Deluan=20Quint=C3=A3o?= Date: Wed, 18 Nov 2026 11:08:13 -0500 Subject: [PATCH] feat(ui): add UIAppendRemixers option to hide remixers from the Artist column (#6504) --- conf/configuration.go | 2 ++ server/serve_index.go | 1 + server/serve_index_test.go | 1 + ui/src/common/ArtistLinkField.jsx | 5 ++- ui/src/common/ArtistLinkField.test.jsx | 47 +++++++++++++++++++++++++- ui/src/config.js | 1 + 6 files changed, 55 insertions(+), 2 deletions(-) diff --git a/conf/configuration.go b/conf/configuration.go index 3b927e874..8d0c0bcd9 100644 --- a/conf/configuration.go +++ b/conf/configuration.go @@ -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) diff --git a/server/serve_index.go b/server/serve_index.go index f6b49dbb5..f75261db0 100644 --- a/server/serve_index.go +++ b/server/serve_index.go @@ -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, diff --git a/server/serve_index_test.go b/server/serve_index_test.go index f9bf14b51..719159189 100644 --- a/server/serve_index_test.go +++ b/server/serve_index_test.go @@ -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"), diff --git a/ui/src/common/ArtistLinkField.jsx b/ui/src/common/ArtistLinkField.jsx index 2a70ded7c..1ceea2d07 100644 --- a/ui/src/common/ArtistLinkField.jsx +++ b/ui/src/common/ArtistLinkField.jsx @@ -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) : [] diff --git a/ui/src/common/ArtistLinkField.test.jsx b/ui/src/common/ArtistLinkField.test.jsx index 09fdf64a4..984986823 100644 --- a/ui/src/common/ArtistLinkField.test.jsx +++ b/ui/src/common/ArtistLinkField.test.jsx @@ -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() + + 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() + + 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', () => { diff --git a/ui/src/config.js b/ui/src/config.js index 62b3cb822..2fb51f28e 100644 --- a/ui/src/config.js +++ b/ui/src/config.js @@ -22,6 +22,7 @@ const defaultConfig = { defaultUIVolume: 100, uiSearchDebounceMs: 200, uiCoverArtSize: 600, + uiAppendRemixers: true, enableUserEditing: true, enableArtworkUpload: true, enableSharing: true,