From 2f3785bd381685e97e6cb9fe9f3b69976973930d Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Thu, 10 Jul 2025 08:51:46 -0300 Subject: content: don't access referenceType --- .../generateContributionTooltipChronologySection.js | 6 +----- .../dependencies/generateCoverArtworkOriginDetails.js | 15 +++++---------- src/content/dependencies/linkAnythingMan.js | 14 +++++--------- src/content/dependencies/linkArtwork.js | 11 +++-------- src/content/dependencies/linkReferencedArtworks.js | 13 +++---------- src/content/dependencies/linkReferencingArtworks.js | 13 +++---------- 6 files changed, 20 insertions(+), 52 deletions(-) (limited to 'src/content/dependencies') diff --git a/src/content/dependencies/generateContributionTooltipChronologySection.js b/src/content/dependencies/generateContributionTooltipChronologySection.js index 378c0e1c..9f419a66 100644 --- a/src/content/dependencies/generateContributionTooltipChronologySection.js +++ b/src/content/dependencies/generateContributionTooltipChronologySection.js @@ -1,13 +1,9 @@ -import Thing from '#thing'; - function getName(thing) { if (!thing) { return null; } - const referenceType = thing.constructor[Thing.referenceType]; - - if (referenceType === 'artwork') { + if (thing.isArtwork) { return thing.thing.name; } diff --git a/src/content/dependencies/generateCoverArtworkOriginDetails.js b/src/content/dependencies/generateCoverArtworkOriginDetails.js index 5a7768fc..ddd44286 100644 --- a/src/content/dependencies/generateCoverArtworkOriginDetails.js +++ b/src/content/dependencies/generateCoverArtworkOriginDetails.js @@ -1,5 +1,3 @@ -import Thing from '#thing'; - export default { contentDependencies: [ 'generateArtistCredit', @@ -11,9 +9,6 @@ export default { extraDependencies: ['html', 'language', 'pagePath'], query: (artwork) => ({ - artworkThingType: - artwork.thing.constructor[Thing.referenceType], - attachedArtistContribs: (artwork.attachedArtwork ? artwork.attachedArtwork.artistContribs @@ -33,7 +28,7 @@ export default { relation('transformContent', artwork.originDetails), albumLink: - (query.artworkThingType === 'album' + (artwork.thing.isAlbum ? relation('linkAlbum', artwork.thing) : null), @@ -48,11 +43,11 @@ export default { label: artwork.label, - artworkThingType: - query.artworkThingType, + forAlbum: + artwork.thing.isAlbum, forSingleStyleAlbum: - query.artworkThingType === 'album' && + artwork.thing.isAlbum && artwork.thing.style === 'single', }), @@ -101,7 +96,7 @@ export default { const trackArtFromAlbum = pagePath[0] === 'track' && - data.artworkThingType === 'album' && + data.forAlbum && !data.forSingleStyleAlbum && language.$(capsule, 'trackArtFromAlbum', { album: diff --git a/src/content/dependencies/linkAnythingMan.js b/src/content/dependencies/linkAnythingMan.js index e408c1b2..10ce7762 100644 --- a/src/content/dependencies/linkAnythingMan.js +++ b/src/content/dependencies/linkAnythingMan.js @@ -6,19 +6,15 @@ export default { 'linkTrack', ], - query: (thing) => ({ - referenceType: thing.constructor[Symbol.for('Thing.referenceType')], - }), - - relations: (relation, query, thing) => ({ + relations: (relation, thing) => ({ link: - (query.referenceType === 'album' + (thing.isAlbum ? relation('linkAlbum', thing) - : query.referenceType === 'artwork' + : thing.isArtwork ? relation('linkArtwork', thing) - : query.referenceType === 'flash' + : thing.isFlash ? relation('linkFlash', thing) - : query.referenceType === 'track' + : thing.isTrack ? relation('linkTrack', thing) : null), }), diff --git a/src/content/dependencies/linkArtwork.js b/src/content/dependencies/linkArtwork.js index 8cd6f359..c10150d1 100644 --- a/src/content/dependencies/linkArtwork.js +++ b/src/content/dependencies/linkArtwork.js @@ -1,16 +1,11 @@ export default { contentDependencies: ['linkAlbum', 'linkTrack'], - query: (artwork) => ({ - referenceType: - artwork.thing.constructor[Symbol.for('Thing.referenceType')], - }), - - relations: (relation, query, artwork) => ({ + relations: (relation, artwork) => ({ link: - (query.referenceType === 'album' + (artwork.thing.isAlbum ? relation('linkAlbum', artwork.thing) - : query.referenceType === 'track' + : artwork.thing.isTrack ? relation('linkTrack', artwork.thing) : null), }), diff --git a/src/content/dependencies/linkReferencedArtworks.js b/src/content/dependencies/linkReferencedArtworks.js index c456b808..f73a2ad3 100644 --- a/src/content/dependencies/linkReferencedArtworks.js +++ b/src/content/dependencies/linkReferencedArtworks.js @@ -1,21 +1,14 @@ -import Thing from '#thing'; - export default { contentDependencies: [ 'linkAlbumReferencedArtworks', 'linkTrackReferencedArtworks', ], - query: (artwork) => ({ - referenceType: - artwork.thing.constructor[Thing.referenceType], - }), - - relations: (relation, query, artwork) => ({ + relations: (relation, artwork) => ({ link: - (query.referenceType === 'album' + (artwork.thing.isAlbum ? relation('linkAlbumReferencedArtworks', artwork.thing) - : query.referenceType === 'track' + : artwork.thing.isTrack ? relation('linkTrackReferencedArtworks', artwork.thing) : null), }), diff --git a/src/content/dependencies/linkReferencingArtworks.js b/src/content/dependencies/linkReferencingArtworks.js index 0cfca4db..6927f230 100644 --- a/src/content/dependencies/linkReferencingArtworks.js +++ b/src/content/dependencies/linkReferencingArtworks.js @@ -1,21 +1,14 @@ -import Thing from '#thing'; - export default { contentDependencies: [ 'linkAlbumReferencingArtworks', 'linkTrackReferencingArtworks', ], - query: (artwork) => ({ - referenceType: - artwork.thing.constructor[Thing.referenceType], - }), - - relations: (relation, query, artwork) => ({ + relations: (relation, artwork) => ({ link: - (query.referenceType === 'album' + (artwork.thing.isAlbum ? relation('linkAlbumReferencingArtworks', artwork.thing) - : query.referenceType === 'track' + : artwork.thing.isTrack ? relation('linkTrackReferencingArtworks', artwork.thing) : null), }), -- cgit 1.3.0-6-gf8a5