« get me outta code hell

data: remove unused Thing.common utilities - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-09-06 12:13:25 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-09-06 12:13:25 -0300
commit9d8616ced8f505b499780e859d96f288d67f2154 (patch)
treec7c089d831e0e70d3d0ab59141ba7b4c2869047a
parent044ac1a804e0f42aaa13a9280ba68effc7a65606 (diff)
data: remove unused Thing.common utilities
dynamicInheritContribs is replaced by more specialized behavior on
tracks (which are the only thing that inherit contribs this way),
and reverseSingleReference, introduced with reverseReferenceList,
was never used anywhere.
-rw-r--r--src/data/things/thing.js68
1 files changed, 0 insertions, 68 deletions
diff --git a/src/data/things/thing.js b/src/data/things/thing.js
index 19f5fb53..ad27ca55 100644
--- a/src/data/things/thing.js
+++ b/src/data/things/thing.js
@@ -257,60 +257,6 @@ export default class Thing extends CacheableObject {
       },
     }),
 
-    // Dynamically inherit a contribution list from some other object, if it
-    // hasn't been overridden on this object. This is handy for solo albums
-    // where all tracks have the same artist, for example.
-    dynamicInheritContribs: (
-      // If this property is explicitly false, the contribution list returned
-      // will always be empty.
-      nullerProperty,
-
-      // Property holding contributions on the current object.
-      contribsByRefProperty,
-
-      // Property holding corresponding "default" contributions on the parent
-      // object, which will fallen back to if the object doesn't have its own
-      // contribs.
-      parentContribsByRefProperty,
-
-      // Data array to search in and "find" function to locate parent object
-      // (which will be passed the child object and the wiki data array).
-      thingDataProperty,
-      findFn
-    ) => ({
-      flags: {expose: true},
-      expose: {
-        dependencies: [
-          'this',
-          contribsByRefProperty,
-          thingDataProperty,
-          nullerProperty,
-          'artistData',
-        ].filter(Boolean),
-
-        compute({
-          this: thing,
-          [nullerProperty]: nuller,
-          [contribsByRefProperty]: contribsByRef,
-          [thingDataProperty]: thingData,
-          artistData,
-        }) {
-          if (!artistData) return [];
-          if (nuller === false) return [];
-          const refs =
-            contribsByRef ??
-            findFn(thing, thingData, {mode: 'quiet'})?.[parentContribsByRefProperty];
-          if (!refs) return [];
-          return refs
-            .map(({who: ref, what}) => ({
-              who: find.artist(ref, artistData),
-              what,
-            }))
-            .filter(({who}) => who);
-        },
-      },
-    }),
-
     // Nice 'n simple shorthand for an exposed-only flag which is true when any
     // contributions are present in the specified property.
     contribsPresent: (contribsByRefProperty) => ({
@@ -340,20 +286,6 @@ export default class Thing extends CacheableObject {
       ]);
     },
 
-    // Corresponding function for single references. Note that the return value
-    // is still a list - this is for matching all the objects whose single
-    // reference (in the given property) matches this Thing.
-    reverseSingleReference: (thingDataProperty, referencerRefListProperty) => ({
-      flags: {expose: true},
-
-      expose: {
-        dependencies: ['this', thingDataProperty],
-
-        compute: ({this: thing, [thingDataProperty]: thingData}) =>
-          thingData?.filter((t) => t[referencerRefListProperty] === thing) ?? [],
-      },
-    }),
-
     // General purpose wiki data constructor, for properties like artistData,
     // trackData, etc.
     wikiData: (thingClass) => ({