« get me outta code hell

don't expose/show coverArtDate without cover art - 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>2022-12-07 06:05:34 -0400
committer(quasar) nebula <qznebula@protonmail.com>2022-12-07 06:05:34 -0400
commitdf92bfb7c0e48d27bc1490b35b9683aa5611ed51 (patch)
treea7762a4046695cf85dd79a76e0c19cfd089ab8ff
parentc703a9337b9d4d535c0b503f91684a2fbff89e93 (diff)
don't expose/show coverArtDate without cover art
-rw-r--r--src/data/things/track.js21
-rw-r--r--src/page/track.js1
2 files changed, 16 insertions, 6 deletions
diff --git a/src/data/things/track.js b/src/data/things/track.js
index d2930ff1..0842bf23 100644
--- a/src/data/things/track.js
+++ b/src/data/things/track.js
@@ -164,17 +164,26 @@ export class Track extends Thing {
       update: {validate: isDate},
 
       expose: {
-        dependencies: ['albumData', 'dateFirstReleased'],
+        dependencies: [
+          'albumData',
+          'coverArtistContribsByRef',
+          'dateFirstReleased',
+          'hasCoverArt',
+        ],
         transform: (coverArtDate, {
           albumData,
+          coverArtistContribsByRef,
           dateFirstReleased,
+          hasCoverArt,
           [Track.instance]: track,
         }) =>
-          coverArtDate ??
-          dateFirstReleased ??
-          Track.findAlbum(track, albumData)?.trackArtDate ??
-          Track.findAlbum(track, albumData)?.date ??
-          null,
+          (Track.hasCoverArt(track, albumData, coverArtistContribsByRef, hasCoverArt)
+            ? coverArtDate ??
+              dateFirstReleased ??
+              Track.findAlbum(track, albumData)?.trackArtDate ??
+              Track.findAlbum(track, albumData)?.date ??
+              null
+            : null),
       },
     },
 
diff --git a/src/page/track.js b/src/page/track.js
index c283aa30..94c9c40a 100644
--- a/src/page/track.js
+++ b/src/page/track.js
@@ -265,6 +265,7 @@ export function write(track, {wikiData}) {
                     date: language.formatDate(track.date),
                   }),
 
+                cover &&
                 track.coverArtDate &&
                 +track.coverArtDate !== +track.date &&
                   language.$('releaseInfo.artReleased', {