« get me outta code hell

content: listArtistsByContributions: handle disabled flashes gracefully - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies
diff options
context:
space:
mode:
authorleo60228 <leo@60228.dev>2024-02-05 16:47:08 -0500
committer(quasar) nebula <qznebula@protonmail.com>2024-02-05 18:16:45 -0400
commitfb2f1135e2c1573515c3f4ab232a8111d25936df (patch)
tree7e81dd4f04a4c660d5e3bde2d573cbf79ac4d523 /src/content/dependencies
parent2fcfbd99e0dedeb2b92d71bdc35550d12392e1f1 (diff)
content: listArtistsByContributions: handle disabled flashes gracefully
Originally named:
"fix Artists by Contributions when flashes are disabled"
Diffstat (limited to 'src/content/dependencies')
-rw-r--r--src/content/dependencies/listArtistsByContributions.js16
1 files changed, 11 insertions, 5 deletions
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,