diff options
Diffstat (limited to 'src/content/dependencies/generateAlbumTrackListItem.js')
-rw-r--r-- | src/content/dependencies/generateAlbumTrackListItem.js | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/src/content/dependencies/generateAlbumTrackListItem.js b/src/content/dependencies/generateAlbumTrackListItem.js index 7d5d2c6e..851bf32e 100644 --- a/src/content/dependencies/generateAlbumTrackListItem.js +++ b/src/content/dependencies/generateAlbumTrackListItem.js @@ -3,7 +3,7 @@ import {compareArrays, empty} from '#sugar'; export default { contentDependencies: [ 'generateAlbumTrackListMissingDuration', - 'linkContribution', + 'generateArtistCredit', 'linkTrack', ], @@ -31,11 +31,10 @@ export default { relations(relation, query, track) { const relations = {}; - if (!empty(track.artistContribs)) { - relations.contributionLinks = - track.artistContribs - .map(contrib => relation('linkContribution', contrib)); - } + relations.credit = + relation('generateArtistCredit', + track.artistContribs, + track.album.artistContribs); relations.trackLink = relation('linkTrack', track); @@ -113,16 +112,25 @@ export default { : relations.missingDuration); } - if (data.showArtists) { + const artistCapsule = language.encapsulate(itemCapsule, 'withArtists'); + + relations.credit.setSlots({ + normalStringKey: + artistCapsule + '.by', + + featuringStringKey: + artistCapsule + '.featuring', + + normalFeaturingStringKey: + artistCapsule + '.by.featuring', + }); + + if (!html.isBlank(relations.credit)) { workingCapsule += '.withArtists'; workingOptions.by = html.tag('span', {class: 'by'}, html.metatag('chunkwrap', {split: ','}, - html.resolve( - language.$(itemCapsule, 'withArtists.by', { - artists: - language.formatConjunctionList(relations.contributionLinks), - })))); + html.resolve(relations.credit))); } return language.$(workingCapsule, workingOptions); |