diff options
-rw-r--r-- | src/data/things/album.js | 6 | ||||
-rw-r--r-- | src/data/things/thing.js | 15 |
2 files changed, 9 insertions, 12 deletions
diff --git a/src/data/things/album.js b/src/data/things/album.js index 2a8c59ed..9ca662a0 100644 --- a/src/data/things/album.js +++ b/src/data/things/album.js @@ -199,9 +199,9 @@ export class Album extends Thing { commentatorArtists: commentatorArtists(), - hasCoverArt: contribsPresent('coverArtistContribs'), - hasWallpaperArt: contribsPresent('wallpaperArtistContribs'), - hasBannerArt: contribsPresent('bannerArtistContribs'), + hasCoverArt: contribsPresent({contribs: 'coverArtistContribs'}), + hasWallpaperArt: contribsPresent({contribs: 'wallpaperArtistContribs'}), + hasBannerArt: contribsPresent({contribs: 'bannerArtistContribs'}), tracks: [ exitWithoutDependency({dependency: 'trackData', value: []}), diff --git a/src/data/things/thing.js b/src/data/things/thing.js index fe9000b4..b1a9a802 100644 --- a/src/data/things/thing.js +++ b/src/data/things/thing.js @@ -15,6 +15,7 @@ import { exposeDependency, exposeDependencyOrContinue, raiseWithoutDependency, + withResultOfAvailabilityCheck, withPropertiesFromList, withUpdateValueAsDependency, } from '#composite'; @@ -318,15 +319,11 @@ export function singleReference({ // Nice 'n simple shorthand for an exposed-only flag which is true when any // contributions are present in the specified property. -export function contribsPresent(contribsProperty) { - return { - flags: {expose: true}, - expose: { - dependencies: [contribsProperty], - compute: ({[contribsProperty]: contribs}) => - !empty(contribs), - }, - }; +export function contribsPresent({contribs}) { + return compositeFrom(`contribsPresent`, [ + withResultOfAvailabilityCheck({fromDependency: contribs, mode: 'empty'}), + exposeDependency({dependency: '#availability'}), + ]); } // Neat little shortcut for "reversing" the reference lists stored on other |