« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateReleaseInfoContributionsLine.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/dependencies/generateReleaseInfoContributionsLine.js')
-rw-r--r--src/content/dependencies/generateReleaseInfoContributionsLine.js74
1 files changed, 14 insertions, 60 deletions
diff --git a/src/content/dependencies/generateReleaseInfoContributionsLine.js b/src/content/dependencies/generateReleaseInfoContributionsLine.js
index c2eb6a46..30048a78 100644
--- a/src/content/dependencies/generateReleaseInfoContributionsLine.js
+++ b/src/content/dependencies/generateReleaseInfoContributionsLine.js
@@ -1,73 +1,27 @@
-import {empty} from '#sugar';
-
 export default {
-  contentDependencies: [
-    'generateReleaseInfoContributionsLineWikiEditsPart',
-    'linkContribution',
-  ],
-
-  extraDependencies: ['html', 'language'],
-
-  query: (contributions) => ({
-    normalContributions:
-      contributions
-        .filter(contrib => !contrib.annotation?.startsWith(`edits for wiki`)),
-
-    wikiEditContributions:
-      contributions
-        .filter(contrib => contrib.annotation?.startsWith(`edits for wiki`)),
-  }),
+  contentDependencies: ['generateArtistCredit'],
+  extraDependencies: ['html'],
 
-  relations: (relation, query, _contributions) => ({
-    contributionLinks:
-      query.normalContributions
-        .map(contrib => relation('linkContribution', contrib)),
-
-    wikiEditsPart:
-      relation('generateReleaseInfoContributionsLineWikiEditsPart',
-        query.wikiEditContributions),
-  }),
-
-  data: (query, _contributions) => ({
-    hasWikiEdits:
-      !empty(query.wikiEditContributions),
+  relations: (relation, contributions) => ({
+    credit:
+      relation('generateArtistCredit', contributions),
   }),
 
   slots: {
-    showAnnotation: {type: 'boolean', default: true},
-    showExternalLinks: {type: 'boolean', default: true},
-    showChronology: {type: 'boolean', default: true},
-
     stringKey: {type: 'string'},
     chronologyKind: {type: 'string'},
   },
 
-  generate(data, relations, slots, {language}) {
-    const contributionsList =
-      language.formatConjunctionList(
-        relations.contributionLinks.map(link =>
-          link.slots({
-            showAnnotation: slots.showAnnotation,
-            showExternalLinks: slots.showExternalLinks,
-            showChronology: slots.showChronology,
-            chronologyKind: slots.chronologyKind,
-          })));
+  generate: (relations, slots) =>
+    relations.credit.slots({
+      showAnnotation: true,
+      showExternalLinks: true,
+      showChronology: true,
 
-    return language.$(slots.stringKey, {
-      [language.onlyIfOptions]: ['artists'],
+      trimAnnotation: false,
 
-      artists:
-        (data.hasWikiEdits
-          ? language.encapsulate('misc.artistLink.withEditsForWiki', capsule =>
-              language.$(capsule, {
-                // It's nonsense to display "+ edits" without
-                // having any regular contributions, also.
-                [language.onlyIfOptions]: ['artists'],
+      stringKey: slots.stringKey,
 
-                artists: contributionsList,
-                edits: relations.wikiEditsPart,
-              }))
-          : contributionsList),
-    });
-  },
+      chronologyKind: slots.chronologyKind,
+    }),
 };