« 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/things
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-12 17:26:47 -0300
commit1fd4db340060e70ffcfb76405611069d785663c1 (patch)
treeb925b42d7471dbe1b8b4feb1b65a397fd53c104b /src/data/things
parentad671f2df1f62de58448a765b6fde23a19737f6c (diff)
data: Contribution.associatedContributions
Diffstat (limited to 'src/data/things')
-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) {