« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/composite/things/contribution/thingPropertyMatches.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/data/composite/things/contribution/thingPropertyMatches.js')
-rw-r--r--src/data/composite/things/contribution/thingPropertyMatches.js19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/data/composite/things/contribution/thingPropertyMatches.js b/src/data/composite/things/contribution/thingPropertyMatches.js
index 4a37f2cf..1e9019b8 100644
--- a/src/data/composite/things/contribution/thingPropertyMatches.js
+++ b/src/data/composite/things/contribution/thingPropertyMatches.js
@@ -1,6 +1,7 @@
 import {input, templateCompositeFrom} from '#composite';
 
 import {exitWithoutDependency} from '#composite/control-flow';
+import {withPropertyFromObject} from '#composite/data';
 
 export default templateCompositeFrom({
   annotation: `thingPropertyMatches`,
@@ -12,19 +13,31 @@ export default templateCompositeFrom({
   },
 
   steps: () => [
+    {
+      dependencies: ['thing', 'thingProperty'],
+
+      compute: (continuation, {thing, thingProperty}) =>
+        continuation({
+          ['#thingProperty']:
+            (thing.constructor[Symbol.for('Thing.referenceType')] === 'artwork'
+              ? thing.artistContribsFromThingProperty
+              : thingProperty),
+        }),
+    },
+
     exitWithoutDependency({
-      dependency: 'thingProperty',
+      dependency: '#thingProperty',
       value: input.value(false),
     }),
 
     {
       dependencies: [
-        'thingProperty',
+        '#thingProperty',
         input('value'),
       ],
 
       compute: ({
-        ['thingProperty']: thingProperty,
+        ['#thingProperty']: thingProperty,
         [input('value')]: value,
       }) =>
         thingProperty === value,