diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-04-10 19:39:41 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-06-12 17:26:47 -0300 |
commit | 69fca8d733f7353ddbfddd4c91883e3bf1495235 (patch) | |
tree | e047ad20abe50739c316ae9574a345a98f215469 /src/content | |
parent | 1fd4db340060e70ffcfb76405611069d785663c1 (diff) |
content: gAIPOtherArtistLinks: use associatedContributions
Diffstat (limited to 'src/content')
5 files changed, 26 insertions, 21 deletions
diff --git a/src/content/dependencies/generateArtistInfoPageArtworksChunkedList.js b/src/content/dependencies/generateArtistInfoPageArtworksChunkedList.js index 44fb42f2..3cda7d90 100644 --- a/src/content/dependencies/generateArtistInfoPageArtworksChunkedList.js +++ b/src/content/dependencies/generateArtistInfoPageArtworksChunkedList.js @@ -154,7 +154,7 @@ export default { itemOtherArtistLinks: query.chunks.map(({chunk}) => - chunk.map(({contribs}) => relation('generateArtistInfoPageOtherArtistLinks', contribs, artist))), + chunk.map(({contribs}) => relation('generateArtistInfoPageOtherArtistLinks', contribs))), }; }, diff --git a/src/content/dependencies/generateArtistInfoPageChunkItem.js b/src/content/dependencies/generateArtistInfoPageChunkItem.js index b6f40727..ee172f48 100644 --- a/src/content/dependencies/generateArtistInfoPageChunkItem.js +++ b/src/content/dependencies/generateArtistInfoPageChunkItem.js @@ -1,3 +1,5 @@ +import {empty} from '#sugar'; + export default { extraDependencies: ['html', 'language'], @@ -35,7 +37,7 @@ export default { const parts = ['artistPage.creditList.entry']; const options = {entry: accentedContent}; - if (slots.otherArtistLinks) { + if (!empty(slots.otherArtistLinks)) { parts.push('withArtists'); options.artists = language.formatConjunctionList(slots.otherArtistLinks); } diff --git a/src/content/dependencies/generateArtistInfoPageCommentaryChunkedList.js b/src/content/dependencies/generateArtistInfoPageCommentaryChunkedList.js index 133095ea..f4413197 100644 --- a/src/content/dependencies/generateArtistInfoPageCommentaryChunkedList.js +++ b/src/content/dependencies/generateArtistInfoPageCommentaryChunkedList.js @@ -10,7 +10,6 @@ export default { contentDependencies: [ 'generateArtistInfoPageChunk', 'generateArtistInfoPageChunkItem', - 'generateArtistInfoPageOtherArtistLinks', 'linkAlbum', 'linkFlash', 'linkFlashAct', diff --git a/src/content/dependencies/generateArtistInfoPageOtherArtistLinks.js b/src/content/dependencies/generateArtistInfoPageOtherArtistLinks.js index 471ee26c..dcee9c00 100644 --- a/src/content/dependencies/generateArtistInfoPageOtherArtistLinks.js +++ b/src/content/dependencies/generateArtistInfoPageOtherArtistLinks.js @@ -1,24 +1,30 @@ -import {empty} from '#sugar'; +import {unique} from '#sugar'; export default { contentDependencies: ['linkArtist'], - relations(relation, contribs, artist) { - const otherArtistContribs = - contribs.filter(contrib => contrib.artist !== artist); + query(contribs) { + const associatedContributionsByOtherArtists = + contribs + .flatMap(ownContrib => + ownContrib.associatedContributions + .filter(associatedContrib => + associatedContrib.artist !== ownContrib.artist)); - if (empty(otherArtistContribs)) { - return {}; - } + const otherArtists = + unique( + associatedContributionsByOtherArtists + .map(contrib => contrib.artist)); - const otherArtistLinks = - otherArtistContribs - .map(contrib => relation('linkArtist', contrib.artist)); - - return {otherArtistLinks}; + return {otherArtists}; }, - generate(relations) { - return relations.otherArtistLinks ?? null; - }, + relations: (relation, query) => ({ + artistLinks: + query.otherArtists + .map(artist => relation('linkArtist', artist)), + }), + + generate: (relations) => + relations.artistLinks, }; diff --git a/src/content/dependencies/generateArtistInfoPageTracksChunkItem.js b/src/content/dependencies/generateArtistInfoPageTracksChunkItem.js index 03ca2ef5..9674eb4f 100644 --- a/src/content/dependencies/generateArtistInfoPageTracksChunkItem.js +++ b/src/content/dependencies/generateArtistInfoPageTracksChunkItem.js @@ -73,9 +73,7 @@ export default { relation('linkTrack', query.track), otherArtistLinks: - relation('generateArtistInfoPageOtherArtistLinks', - contribs, - artist), + relation('generateArtistInfoPageOtherArtistLinks', contribs), }), data: (query) => ({ |