« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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', {