« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/data/things/contribution.js28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/data/things/contribution.js b/src/data/things/contribution.js
index cfece5dc..7b1518ab 100644
--- a/src/data/things/contribution.js
+++ b/src/data/things/contribution.js
@@ -7,7 +7,8 @@ import {empty} from '#sugar';
 import Thing from '#thing';
 import {isStringNonEmpty, isThing, validateReference} from '#validators';
 
-import {exposeDependency} from '#composite/control-flow';
+import {exitWithoutDependency, exposeDependency} from '#composite/control-flow';
+import {withPropertyFromObject} from '#composite/data';
 import {withResolvedReference} from '#composite/wiki-data';
 import {flag, simpleDate} from '#composite/wiki-properties';
 
@@ -95,6 +96,31 @@ export class Contribution extends Thing {
         dependency: '#matchingContributionPresets',
       }),
     ],
+
+    // All the contributions from the list which includes this contribution.
+    // Note that this list contains not only other contributions by the same
+    // artist, but also this very contribution. It doesn't mix contributions
+    // exposed on different properties.
+    associatedContributions: [
+      exitWithoutDependency({
+        dependency: 'thing',
+        value: input.value([]),
+      }),
+
+      exitWithoutDependency({
+        dependency: 'thingProperty',
+        value: input.value([]),
+      }),
+
+      withPropertyFromObject({
+        object: 'thing',
+        property: 'thingProperty',
+      }),
+
+      exposeDependency({
+        dependency: '#value',
+      }),
+    ],
   });
 
   [inspect.custom](depth, options, inspect) {