1
Fork 0

Filter out discography entries from the known link candidates.

This commit is contained in:
Bauke 2022-01-07 22:41:48 +01:00
parent 67457393d6
commit e3faf966df
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
1 changed files with 6 additions and 1 deletions

View File

@ -10,6 +10,7 @@ type ApiReleaseData = {
};
id: string;
relations: Array<{
type: string;
url: {
resource: string;
};
@ -50,7 +51,11 @@ export default class Release {
? `https://coverartarchive.org/release/${mbid}/front-500`
: undefined;
const relations = new Set(data.relations.map(({url}) => url.resource));
const relations = new Set(
data.relations
.filter((relation) => relation.type !== 'discography entry')
.map((relation) => relation.url.resource),
);
const links = Array.from(relations)
.map((url) => new RelationLink(url))
.sort((a, b) => a.text.localeCompare(b.text));