« 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/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.