« get me outta code hell

content: generateReleaseInfoListenLine: single inheritence - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-07-04 21:10:49 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-07-04 21:10:49 -0300
commit7c95ef32a8beeb22218144ca769a260447712a15 (patch)
tree332ff17e5152a8823f3dab54ccfaf407cec32dc5 /src
parent320b18f92b1b413f3a8b349e12a840f70165effc (diff)
content: generateReleaseInfoListenLine: single inheritence preview
This probably belongs in data code, but we don't have any data
integration for singles just yet, so's................
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/generateReleaseInfoListenLine.js17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/content/dependencies/generateReleaseInfoListenLine.js b/src/content/dependencies/generateReleaseInfoListenLine.js
index f2a6dd29..b02ff6f9 100644
--- a/src/content/dependencies/generateReleaseInfoListenLine.js
+++ b/src/content/dependencies/generateReleaseInfoListenLine.js
@@ -35,6 +35,15 @@ export default {
         ? thing.album
         : thing);
 
+    query.urls =
+      (!empty(thing.urls)
+        ? thing.urls
+     : thing.album &&
+       thing.album.style === 'single' &&
+       thing.album.tracks[0] === thing
+        ? thing.album.urls
+        : []);
+
     query.artists =
       thing.artistContribs
         .map(contrib => contrib.artist);
@@ -56,9 +65,9 @@ export default {
     return query;
   },
 
-  relations: (relation, _query, thing) => ({
+  relations: (relation, query, _thing) => ({
     links:
-      thing.urls.map(url => relation('linkExternal', url)),
+      query.urls.map(url => relation('linkExternal', url)),
   }),
 
   data(query, thing) {
@@ -85,7 +94,7 @@ export default {
       });
 
     let releaseContexts =
-      thing.urls.map(boundGetReleaseContext);
+      query.urls.map(boundGetReleaseContext);
 
     const albumReleaseContexts =
       query.album.urls.map(boundGetReleaseContext);
@@ -101,7 +110,7 @@ export default {
       presentAlbumReleaseContexts.length <= 1
     ) {
       releaseContexts =
-        thing.urls.map(() => null);
+        query.urls.map(() => null);
     }
 
     data.releaseContexts = releaseContexts;