« get me outta code hell

data, yaml: find.artistIncludingAliases -> find.artistAlias - 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>2024-02-16 08:14:18 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-02-16 08:18:43 -0400
commit5108cf043ebe41de0c62887eaaeb51f0d3d70594 (patch)
tree8d5d88f10a05e62157127c1ab2f462b966139748 /src
parent98561e7bbc8137f3b1cb222d9ed4cfb3c6fc6bd9 (diff)
data, yaml: find.artistIncludingAliases -> find.artistAlias
Diffstat (limited to 'src')
-rw-r--r--src/data/things/artist.js9
-rw-r--r--src/data/yaml.js3
2 files changed, 4 insertions, 8 deletions
diff --git a/src/data/things/artist.js b/src/data/things/artist.js
index 589eca90..6e61c28f 100644
--- a/src/data/things/artist.js
+++ b/src/data/things/artist.js
@@ -256,16 +256,13 @@ export class Artist extends Thing {
       include: artist => !artist.isAlias,
     },
 
-    artistIncludingAliases: {
+    artistAlias: {
       referenceTypes: ['artist', 'artist-gallery'],
       bindTo: 'artistData',
 
-      getMatchableDirectories(artist) {
-        // Regular artists are always matchable by their directory.
-        if (!artist.isAlias) {
-          return [artist.directory];
-        }
+      include: artist => artist.isAlias,
 
+      getMatchableDirectories(artist) {
         const originalArtist = artist.aliasedArtist;
 
         // Aliases never match by the same directory as the original.
diff --git a/src/data/yaml.js b/src/data/yaml.js
index 8b8a8ab2..fadafbd5 100644
--- a/src/data/yaml.js
+++ b/src/data/yaml.js
@@ -1157,9 +1157,8 @@ export function filterReferenceErrors(wikiData) {
 
   const boundFind = bindFind(wikiData, {mode: 'error'});
 
-  const artistAliasData = wikiData.artistData.filter(artist => artist.isAlias);
   const findArtistOrAlias = artistRef => {
-    const alias = find.artistIncludingAliases(artistRef, artistAliasData, {mode: 'quiet'});
+    const alias = boundFind.artistAlias(artistRef, {mode: 'quiet'});
     if (alias) {
       // No need to check if the original exists here. Aliases are automatically
       // created from a field on the original, so the original certainly exists.