« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/util/external-links.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/util/external-links.js b/src/util/external-links.js
index 0c6e9d59..846302af 100644
--- a/src/util/external-links.js
+++ b/src/util/external-links.js
@@ -608,6 +608,17 @@ export function getExternalLinkStringOfStyleFromDescriptor(url, style, descripto
     return language.$(prefix, descriptor.platform);
   }
 
+  function getPlatformOrDomain() {
+    // The fallback descriptor has a "platform" which is just
+    // the word "External". This isn't really useful when you're
+    // looking for platform info! Compact mode shows the domain.
+    if (descriptor === fallbackDescriptor) {
+      return getCompactDomain();
+    } else {
+      return getPlatform();
+    }
+  }
+
   function getDomain() {
     return urlParts(url).domain;
   }
@@ -710,7 +721,7 @@ export function getExternalLinkStringOfStyleFromDescriptor(url, style, descripto
   switch (style) {
     case 'normal': return getNormal();
     case 'compact': return getCompact();
-    case 'platform': return getPlatform();
+    case 'platform': return getPlatformOrDomain();
     case 'icon-id': return getIconId();
   }
 }