diff options
-rw-r--r-- | src/data/things.js | 13 | ||||
-rw-r--r-- | src/util/wiki-data.js | 2 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/data/things.js b/src/data/things.js index 330419c7..02697319 100644 --- a/src/data/things.js +++ b/src/data/things.js @@ -546,7 +546,6 @@ Track.propertyDescriptors = { urls: Thing.common.urls(), dateFirstReleased: Thing.common.simpleDate(), - hasCoverArt: Thing.common.flag(true), hasURLs: Thing.common.flag(true), referencedTracksByRef: Thing.common.referenceList(Track), @@ -556,6 +555,18 @@ Track.propertyDescriptors = { contributorContribsByRef: Thing.common.contribsByRef(), coverArtistContribsByRef: Thing.common.contribsByRef(), + hasCoverArt: { + flags: {update: true, expose: true}, + + update: {validate: isBoolean}, + + expose: { + dependencies: ['albumData'], + transform: (hasCoverArt, { albumData, [Track.instance]: track }) => ( + hasCoverArt ?? Track.findAlbum(track, albumData)?.hasTrackArt ?? true) + } + }, + // Previously known as: (track).aka originalReleaseTrackByRef: Thing.common.singleReference(Track), diff --git a/src/util/wiki-data.js b/src/util/wiki-data.js index 41071d17..36c61454 100644 --- a/src/util/wiki-data.js +++ b/src/util/wiki-data.js @@ -159,7 +159,7 @@ export function getTotalDuration(tracks) { export function getTrackCover(track, {to}) { // Some al8ums don't have any track art at all, and in those, every track // just inherits the al8um's own cover art. - if (track.coverArtists === null) { + if (!track.hasCoverArt) { return getAlbumCover(track.album, {to}); } else { return to('media.trackCover', track.album.directory, track.directory); |