« get me outta code hell

data: inheritContributionListFromOriginalRelease - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/composite
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-03-06 13:45:13 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-06-12 17:26:34 -0300
commit34f6afb3b0cf4d39b0b70a0169376d886ebce42d (patch)
tree6491f145c4ce84ce10ae210aaa5821bd24dbd343 /src/data/composite
parent323c8df744ea58e52f107e4a85589e8e338998cd (diff)
data: inheritContributionListFromOriginalRelease
Diffstat (limited to 'src/data/composite')
-rw-r--r--src/data/composite/things/track/index.js1
-rw-r--r--src/data/composite/things/track/inheritContributionListFromOriginalRelease.js35
2 files changed, 36 insertions, 0 deletions
diff --git a/src/data/composite/things/track/index.js b/src/data/composite/things/track/index.js
index 8959de9f..b76966d1 100644
--- a/src/data/composite/things/track/index.js
+++ b/src/data/composite/things/track/index.js
@@ -1,5 +1,6 @@
 export {default as exitWithoutUniqueCoverArt} from './exitWithoutUniqueCoverArt.js';
 export {default as inferredAdditionalNameList} from './inferredAdditionalNameList.js';
+export {default as inheritContributionListFromOriginalRelease} from './inheritContributionListFromOriginalRelease.js';
 export {default as inheritFromOriginalRelease} from './inheritFromOriginalRelease.js';
 export {default as sharedAdditionalNameList} from './sharedAdditionalNameList.js';
 export {default as trackReverseReferenceList} from './trackReverseReferenceList.js';
diff --git a/src/data/composite/things/track/inheritContributionListFromOriginalRelease.js b/src/data/composite/things/track/inheritContributionListFromOriginalRelease.js
new file mode 100644
index 00000000..9e01f119
--- /dev/null
+++ b/src/data/composite/things/track/inheritContributionListFromOriginalRelease.js
@@ -0,0 +1,35 @@
+// Like inheritFromOriginalRelease, but tuned for contributions.
+// Recontextualized contributions for this track.
+
+import {input, templateCompositeFrom} from '#composite';
+
+import {exposeDependency, raiseOutputWithoutDependency}
+  from '#composite/control-flow';
+import {withRecontextualizedContributionList} from '#composite/wiki-data';
+
+import withPropertyFromOriginalRelease
+  from './withPropertyFromOriginalRelease.js';
+
+export default templateCompositeFrom({
+  annotation: `inheritContributionListFromOriginalRelease`,
+
+  steps: () => [
+    withPropertyFromOriginalRelease({
+      property: input.thisProperty(),
+      notFoundValue: input.value([]),
+    }),
+
+    raiseOutputWithoutDependency({
+      dependency: '#isRerelease',
+      mode: input.value('falsy'),
+    }),
+
+    withRecontextualizedContributionList({
+      list: '#originalValue',
+    }),
+
+    exposeDependency({
+      dependency: '#originalValue',
+    }),
+  ],
+});