diff options
Diffstat (limited to 'src/data/composite/wiki-data/withRecontextualizedContributionList.js')
| -rw-r--r-- | src/data/composite/wiki-data/withRecontextualizedContributionList.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/data/composite/wiki-data/withRecontextualizedContributionList.js b/src/data/composite/wiki-data/withRecontextualizedContributionList.js index bcc6e486..66ac056a 100644 --- a/src/data/composite/wiki-data/withRecontextualizedContributionList.js +++ b/src/data/composite/wiki-data/withRecontextualizedContributionList.js @@ -1,14 +1,15 @@ // Clones all the contributions in a list, with thing and thingProperty both // updated to match the current thing. Overwrites the provided dependency. -// Optionally updates artistProperty as well. Doesn't do anything if -// the provided dependency is null. +// Optionally updates artistProperty, and optionally reclasses as another +// kind of contribution. Does nothing if the provided dependency is null. // // See also: // - withRedatedContributionList // import {input, templateCompositeFrom} from '#composite'; -import {isStringNonEmpty} from '#validators'; +import thingConstructors from '#thing'; +import {isStringNonEmpty, isThingClass} from '#validators'; import {withClonedThings} from '#composite/wiki-data'; @@ -21,6 +22,11 @@ export default templateCompositeFrom({ acceptsNull: true, }), + reclass: input({ + validate: isThingClass, + defaultValue: null, + }), + artistProperty: input({ validate: isStringNonEmpty, defaultValue: null, @@ -77,6 +83,8 @@ export default templateCompositeFrom({ withClonedThings({ things: input('list'), + reclass: input('reclass'), + reclassUnder: input.value(thingConstructors.Contribution), assign: '#assignment', }).outputs({ '#clonedThings': '#newContributions', |