From 34f6afb3b0cf4d39b0b70a0169376d886ebce42d Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 6 Mar 2024 13:45:13 -0400 Subject: data: inheritContributionListFromOriginalRelease --- src/data/composite/things/track/index.js | 1 + .../inheritContributionListFromOriginalRelease.js | 35 ++++++++++++++++++++++ src/data/things/track.js | 10 ++----- 3 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 src/data/composite/things/track/inheritContributionListFromOriginalRelease.js (limited to 'src/data') 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', + }), + ], +}); diff --git a/src/data/things/track.js b/src/data/things/track.js index ce9f413c..eda68a4e 100644 --- a/src/data/things/track.js +++ b/src/data/things/track.js @@ -54,6 +54,7 @@ import { import { exitWithoutUniqueCoverArt, inferredAdditionalNameList, + inheritContributionListFromOriginalRelease, inheritFromOriginalRelease, sharedAdditionalNameList, trackReverseReferenceList, @@ -200,9 +201,7 @@ export class Track extends Thing { }), artistContribs: [ - inheritFromOriginalRelease({ - notFoundValue: input.value([]), - }), + inheritContributionListFromOriginalRelease(), withResolvedContribs({ from: input.updateValue({validate: isContributionList}), @@ -228,10 +227,7 @@ export class Track extends Thing { ], contributorContribs: [ - inheritFromOriginalRelease({ - notFoundValue: input.value([]), - }), - + inheritContributionListFromOriginalRelease(), contributionList(), ], -- cgit 1.3.0-6-gf8a5