« get me outta code hell

data: Contribution.associatedContributions - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-04-10 19:39:09 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-06-18 22:56:05 -0300
commitdd5f7fe008a8b7c207e0f82255fedd1442f41b04 (patch)
treefa228eb3443befe0416fef9e8209ce7682ed6663 /src/data
parent0f1015d84db262c6c3dee9ca853d8fe55632ec67 (diff)
data: Contribution.associatedContributions
Diffstat (limited to 'src/data')
-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) {