mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-21 23:05:46 +00:00
fix(composers): hide performer-only artists with zero composer credits (#963)
* fix(composers): drop Navidrome role rows with zero composer albums Navidrome can list performer-only artists under role=composer with stats.composer.albumCount 0; filter them out of the Composers catalog so search no longer surfaces ghost entries like Apollo 440. * docs(changelog): credit zunoz on Psysonic Discord for PR #963
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { filterArtistsWithRoleAlbumCredits } from './composerBrowse';
|
||||
|
||||
describe('filterArtistsWithRoleAlbumCredits', () => {
|
||||
it('removes artists with zero role-scoped album count', () => {
|
||||
const artists = [
|
||||
{ id: '1', name: 'Bach', albumCount: 12 },
|
||||
{ id: '2', name: 'Apollo 440', albumCount: 0 },
|
||||
];
|
||||
expect(filterArtistsWithRoleAlbumCredits(artists)).toEqual([artists[0]]);
|
||||
});
|
||||
|
||||
it('removes artists when role album count is missing', () => {
|
||||
const artists = [{ id: '1', name: 'Ghost', albumCount: undefined }];
|
||||
expect(filterArtistsWithRoleAlbumCredits(artists)).toEqual([]);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
import type { SubsonicArtist } from '../../api/subsonicTypes';
|
||||
|
||||
/**
|
||||
* Navidrome's `/api/artist?role=composer` can include artists whose
|
||||
* `stats.composer.albumCount` is zero (performer-only credits with no composer
|
||||
* tags). Drop them from the Composers browse catalog.
|
||||
*/
|
||||
export function filterArtistsWithRoleAlbumCredits(artists: SubsonicArtist[]): SubsonicArtist[] {
|
||||
return artists.filter(a => (a.albumCount ?? 0) > 0);
|
||||
}
|
||||
Reference in New Issue
Block a user