From 1fd4db340060e70ffcfb76405611069d785663c1 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 10 Apr 2024 19:39:09 -0300 Subject: data: Contribution.associatedContributions --- src/data/things/contribution.js | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) 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) { -- cgit 1.3.0-6-gf8a5