« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/data/things/album.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/data/things/album.js b/src/data/things/album.js
index 4890aaaa..281da871 100644
--- a/src/data/things/album.js
+++ b/src/data/things/album.js
@@ -36,8 +36,14 @@ export class Album extends Thing {
       update: {validate: isDate},
 
       expose: {
-        dependencies: ['date'],
-        transform: (coverArtDate, {date}) => coverArtDate ?? date ?? null,
+        dependencies: ['date', 'hasCoverArt'],
+        transform: (coverArtDate, {
+          date,
+          hasCoverArt,
+        }) =>
+          (hasCoverArt
+            ? coverArtDate ?? date ?? null
+            : null),
       },
     },