« get me outta code hell

data: Contribution.associatedContributions: segregate wiki edits - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-08-15 12:01:23 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-08-15 12:01:23 -0300
commit0fb2784f7b7d02df3c25db49ec43d2b178035bbe (patch)
tree3947679d3d35f0fb6f6d200917665338325ba051 /src
parent43eaf804221468acaaa3cf60a30ddabae4de40b8 (diff)
data: Contribution.associatedContributions: segregate wiki edits
Diffstat (limited to 'src')
-rw-r--r--src/data/things/contribution.js38
1 files changed, 36 insertions, 2 deletions
diff --git a/src/data/things/contribution.js b/src/data/things/contribution.js
index 79acf1e1..82ec1db3 100644
--- a/src/data/things/contribution.js
+++ b/src/data/things/contribution.js
@@ -8,11 +8,17 @@ import Thing from '#thing';
 import {isStringNonEmpty, isThing, validateReference} from '#validators';
 
 import {exitWithoutDependency, exposeDependency} from '#composite/control-flow';
-import {withNearbyItemFromList, withPropertyFromObject} from '#composite/data';
 import {withResolvedReference} from '#composite/wiki-data';
 import {flag, simpleDate} from '#composite/wiki-properties';
 
 import {
+  withFilteredList,
+  withNearbyItemFromList,
+  withPropertyFromList,
+  withPropertyFromObject,
+} from '#composite/data';
+
+import {
   inheritFromContributionPresets,
   thingPropertyMatches,
   thingReferenceTypeMatches,
@@ -123,10 +129,38 @@ export class Contribution extends Thing {
       withPropertyFromObject({
         object: 'thing',
         property: 'thingProperty',
+      }).outputs({
+        '#value': '#contributions',
+      }),
+
+      withPropertyFromList({
+        list: '#contributions',
+        property: input.value('annotation'),
+      }),
+
+      {
+        dependencies: ['#contributions.annotation', 'annotation'],
+        compute: (continuation, {
+          ['#contributions.annotation']: contributionAnnotations,
+          ['annotation']: annotation,
+        }) => continuation({
+          ['#likeContributionsFilter']:
+            contributionAnnotations.map(mappingAnnotation =>
+              (annotation === 'edits for wiki'
+                ? mappingAnnotation === annotation
+                : mappingAnnotation !== 'edits for wiki')),
+        }),
+      },
+
+      withFilteredList({
+        list: '#contributions',
+        filter: '#likeContributionsFilter',
+      }).outputs({
+        '#filteredList': '#contributions',
       }),
 
       exposeDependency({
-        dependency: '#value',
+        dependency: '#contributions',
       }),
     ],