diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-09-12 14:47:15 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-09-12 14:47:15 -0300 |
commit | 113157085c7bd6f23bd7c08ad6cd2d94673d7033 (patch) | |
tree | a78ddd133766eb2cc9f22a99155132d8718e752f /src/content/dependencies | |
parent | 44f1442bf28bac7b07ac25c1ea15c6b3a9d1223a (diff) |
content: artist..{TracksChunkedList,ChunkItem}: avoid double sanitize
No further changes needed for artwork and flash chunked lists, where contributions consist of only one item (which might be null).
Diffstat (limited to 'src/content/dependencies')
-rw-r--r-- | src/content/dependencies/generateArtistInfoPageChunkItem.js | 4 | ||||
-rw-r--r-- | src/content/dependencies/generateArtistInfoPageTracksChunkedList.js | 25 |
2 files changed, 18 insertions, 11 deletions
diff --git a/src/content/dependencies/generateArtistInfoPageChunkItem.js b/src/content/dependencies/generateArtistInfoPageChunkItem.js index 36f0ebcc..9f99513d 100644 --- a/src/content/dependencies/generateArtistInfoPageChunkItem.js +++ b/src/content/dependencies/generateArtistInfoPageChunkItem.js @@ -5,7 +5,7 @@ export default { content: {type: 'html'}, otherArtistLinks: {validate: v => v.strictArrayOf(v.isHTML)}, - contribution: {type: 'string'}, + contribution: {type: 'html'}, rerelease: {type: 'boolean'}, }, @@ -30,7 +30,7 @@ export default { options.artists = language.formatConjunctionList(slots.otherArtistLinks); } - if (slots.contribution) { + if (!html.isBlank(slots.contribution)) { parts.push('withContribution'); options.contribution = slots.contribution; } diff --git a/src/content/dependencies/generateArtistInfoPageTracksChunkedList.js b/src/content/dependencies/generateArtistInfoPageTracksChunkedList.js index 0566f713..654f759c 100644 --- a/src/content/dependencies/generateArtistInfoPageTracksChunkedList.js +++ b/src/content/dependencies/generateArtistInfoPageTracksChunkedList.js @@ -1,4 +1,4 @@ -import {accumulateSum, stitchArrays} from '#sugar'; +import {accumulateSum, empty, stitchArrays} from '#sugar'; import { chunkByProperties, @@ -16,7 +16,7 @@ export default { 'linkTrack', ], - extraDependencies: ['language'], + extraDependencies: ['html', 'language'], query(artist) { const tracksAsArtistAndContributor = @@ -122,11 +122,16 @@ export default { trackContributions: query.chunks.map(({chunk}) => - chunk.map(({contribs}) => - contribs - .filter(({who}) => who === artist) - .filter(({what}) => what) - .map(({what}) => what))), + chunk + .map(({contribs}) => + contribs + .filter(({who}) => who === artist) + .filter(({what}) => what) + .map(({what}) => what)) + .map(contributions => + (empty(contributions) + ? null + : contributions))), trackRereleases: query.chunks.map(({chunk}) => @@ -134,7 +139,7 @@ export default { }; }, - generate(data, relations, {language}) { + generate(data, relations, {html, language}) { return relations.chunkedList.slots({ chunks: stitchArrays({ @@ -192,7 +197,9 @@ export default { rerelease, contribution: - language.formatUnitList(contribution), + (contribution + ? language.formatUnitList(contribution) + : html.blank()), content: (duration |