« get me outta code hell

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:
Diffstat (limited to 'src/data')
-rw-r--r--src/data/things/track.js50
1 files changed, 33 insertions, 17 deletions
diff --git a/src/data/things/track.js b/src/data/things/track.js
index 118e3db0..414d5f29 100644
--- a/src/data/things/track.js
+++ b/src/data/things/track.js
@@ -223,29 +223,45 @@ export class Track extends Thing {
     // the usual hasCoverArt to emphasize that it does not inherit from the
     // album.)
     hasUniqueCoverArt: Thing.composite.from(`Track.hasUniqueCoverArt`, [
+      {
+        flags: {expose: true, compose: true},
+        expose: {
+          dependencies: ['disableUniqueCoverArt'],
+          compute: ({disableUniqueCoverArt}, continuation) =>
+            (disableUniqueCoverArt
+              ? false
+              : continuation()),
+        },
+      },
+
+      Thing.composite.withResolvedContribs({
+        from: 'coverArtistContribsByRef',
+        to: '#coverArtistContribs',
+      }),
+
+      {
+        flags: {expose: true, compose: true},
+        expose: {
+          dependencies: ['#coverArtistContribs'],
+          compute: ({'#coverArtistContribs': coverArtistContribs}, continuation) =>
+            (empty(coverArtistContribs)
+              ? continuation()
+              : true),
+        },
+      },
+
       Track.composite.withAlbumProperties({
-        properties: ['trackCoverArtistContribsByRef'],
+        properties: ['trackCoverArtistContribs'],
       }),
 
       {
         flags: {expose: true},
         expose: {
-          dependencies: [
-            'coverArtistContribsByRef',
-            'disableUniqueCoverArt',
-            '#album.trackCoverArtistContribsByRef',
-          ],
-
-          compute({
-            coverArtistContribsByRef,
-            disableUniqueCoverArt,
-            '#album.trackCoverArtistContribsByRef': trackCoverArtistContribsByRef,
-          }) {
-            if (disableUniqueCoverArt) return false;
-            if (!empty(coverArtistContribsByRef)) return true;
-            if (!empty(trackCoverArtistContribsByRef)) return true;
-            return false;
-          },
+          dependencies: ['#album.trackCoverArtistContribs'],
+          compute: ({'#album.trackCoverArtistContribs': trackCoverArtistContribs}) =>
+            (empty(trackCoverArtistContribs)
+              ? false
+              : true),
         },
       },
     ]),