From fb2f1135e2c1573515c3f4ab232a8111d25936df Mon Sep 17 00:00:00 2001 From: leo60228 Date: Mon, 5 Feb 2024 16:47:08 -0500 Subject: content: listArtistsByContributions: handle disabled flashes gracefully Originally named: "fix Artists by Contributions when flashes are disabled" --- src/content/dependencies/listArtistsByContributions.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/content/dependencies/listArtistsByContributions.js b/src/content/dependencies/listArtistsByContributions.js index 234c7edd..61141155 100644 --- a/src/content/dependencies/listArtistsByContributions.js +++ b/src/content/dependencies/listArtistsByContributions.js @@ -107,22 +107,28 @@ export default { }, generate(data, relations, {language}) { - const listChunkIDs = ['tracks', 'artworks', 'flashes']; - const listTitleStringsKeys = ['trackContributors', 'artContributors', 'flashContributors']; - const listCountFunctions = ['countTracks', 'countArtworks', 'countFlashes']; + const listChunkIDs = ['tracks', 'artworks']; + const listTitleStringsKeys = ['trackContributors', 'artContributors']; + const listCountFunctions = ['countTracks', 'countArtworks']; const listArtistLinks = [ relations.artistLinksByTrackContributions, relations.artistLinksByArtworkContributions, - relations.artistLinksByFlashContributions, ]; const listArtistCounts = [ data.countsByTrackContributions, data.countsByArtworkContributions, - data.countsByFlashContributions, ]; + if (data.enableFlashesAndGames) { + listChunkIDs.push('flashes'); + listTitleStringsKeys.push('flashContributors'); + listCountFunctions.push('countFlashes'); + listArtistLinks.push(relations.artistLinksByFlashContributions); + listArtistCounts.push(data.countsByFlashContributions); + } + filterMultipleArrays( listChunkIDs, listTitleStringsKeys, -- cgit 1.3.0-6-gf8a5