« get me outta code hell

data: Contribution.matchingPresets: finish toplevelizing - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-12-10 17:52:37 -0400
committer(quasar) nebula <qznebula@protonmail.com>2025-12-10 17:52:37 -0400
commit24322e79ef3659decc634c036624ace739d2a469 (patch)
tree3a4d9e6060669edc87c52a812d840e522186992e
parentbda82defb35024bce2c699f9074ee147db1262a7 (diff)
data: Contribution.matchingPresets: finish toplevelizing preview
-rw-r--r--src/data/composite/things/contribution/inheritFromContributionPresets.js4
-rw-r--r--src/data/things/contribution.js26
2 files changed, 12 insertions, 18 deletions
diff --git a/src/data/composite/things/contribution/inheritFromContributionPresets.js b/src/data/composite/things/contribution/inheritFromContributionPresets.js
index b429b3ef..17387404 100644
--- a/src/data/composite/things/contribution/inheritFromContributionPresets.js
+++ b/src/data/composite/things/contribution/inheritFromContributionPresets.js
@@ -8,12 +8,12 @@ export default templateCompositeFrom({
 
   steps: () => [
     raiseOutputWithoutDependency({
-      dependency: 'matchingContributionPresets',
+      dependency: 'matchingPresets',
       mode: input.value('empty'),
     }),
 
     withPropertyFromList({
-      list: 'matchingContributionPresets',
+      list: 'matchingPresets',
       property: input.thisProperty(),
     }),
 
diff --git a/src/data/things/contribution.js b/src/data/things/contribution.js
index 1187f75d..393a60b4 100644
--- a/src/data/things/contribution.js
+++ b/src/data/things/contribution.js
@@ -151,10 +151,7 @@ export class Contribution extends Thing {
       withPropertyFromObject('#thing.wikiInfo', V('contributionPresets'))
         .outputs({'#thing.wikiInfo.contributionPresets': '#contributionPresets'}),
 
-      exitWithoutDependency('#contributionPresets', {
-        value: input.value([]),
-        mode: input.value('empty'),
-      }),
+      exitWithoutDependency('#contributionPresets', V([]), V('empty')),
 
       withContributionContext(),
 
@@ -167,22 +164,19 @@ export class Contribution extends Thing {
           'annotation',
         ],
 
-        compute: (continuation, {
+        compute: ({
           ['#contributionPresets']: presets,
           ['#contributionTarget']: target,
           ['#contributionProperty']: property,
           ['annotation']: annotation,
-        }) => continuation({
-          ['#matchingContributionPresets']:
-            presets
-              .filter(preset =>
-                preset.context[0] === target &&
-                preset.context.slice(1).includes(property) &&
-                // For now, only match if the annotation is a complete match.
-                // Partial matches (e.g. because the contribution includes "two"
-                // annotations, separated by commas) don't count.
-                preset.annotation === annotation),
-        })
+        }) =>
+          presets.filter(preset =>
+            preset.context[0] === target &&
+            preset.context.slice(1).includes(property) &&
+            // For now, only match if the annotation is a complete match.
+            // Partial matches (e.g. because the contribution includes "two"
+            // annotations, separated by commas) don't count.
+            preset.annotation === annotation),
       },
     ],