« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/data/checks.js11
-rw-r--r--src/data/composite/wiki-data/withResolvedReference.js7
-rw-r--r--src/data/composite/wiki-data/withResolvedReferenceList.js7
-rw-r--r--src/find.js2
4 files changed, 21 insertions, 6 deletions
diff --git a/src/data/checks.js b/src/data/checks.js
index ebf6aad4..2b660421 100644
--- a/src/data/checks.js
+++ b/src/data/checks.js
@@ -229,6 +229,16 @@ function decoSuppressFindErrors(findFn, {property}) {
   }, findFn);
 }
 
+function decoFindThing(findFn, thing) {
+  return (ref, opts) => {
+    if (opts) {
+      return findFn(ref, {...opts, from: thing});
+    } else {
+      return findFn(ref, {from: thing});
+    }
+  };
+}
+
 // Warn about references across data which don't match anything.  This involves
 // using the find() functions on all references, setting it to 'error' mode, and
 // collecting everything in a structured logged (which gets logged if there are
@@ -549,6 +559,7 @@ export function filterReferenceErrors(wikiData, {
 
             findFn = decoSuppressFindErrors(findFn, {property});
             findFn = decoAnnotateFindErrors(findFn);
+            findFn = decoFindThing(findFn, thing);
 
             const fieldPropertyMessage =
               getFieldPropertyMessage(
diff --git a/src/data/composite/wiki-data/withResolvedReference.js b/src/data/composite/wiki-data/withResolvedReference.js
index d9a05367..58523a65 100644
--- a/src/data/composite/wiki-data/withResolvedReference.js
+++ b/src/data/composite/wiki-data/withResolvedReference.js
@@ -38,14 +38,15 @@ export default templateCompositeFrom({
     }),
 
     {
-      dependencies: [input('findOptions')],
+      dependencies: [input('findOptions'), input.myself()],
       compute: (continuation, {
         [input('findOptions')]: findOptions,
+        [input.myself()]: myself,
       }) => continuation({
         ['#findOptions']:
           (findOptions
-            ? {...findOptions, mode: 'quiet'}
-            : {mode: 'quiet'}),
+            ? {...findOptions, mode: 'quiet', from: myself}
+            : {mode: 'quiet', from: myself}),
       }),
     },
 
diff --git a/src/data/composite/wiki-data/withResolvedReferenceList.js b/src/data/composite/wiki-data/withResolvedReferenceList.js
index 14ce6919..23f3c365 100644
--- a/src/data/composite/wiki-data/withResolvedReferenceList.js
+++ b/src/data/composite/wiki-data/withResolvedReferenceList.js
@@ -49,14 +49,15 @@ export default templateCompositeFrom({
     }),
 
     {
-      dependencies: [input('findOptions')],
+      dependencies: [input('findOptions'), input.myself()],
       compute: (continuation, {
         [input('findOptions')]: findOptions,
+        [input.myself()]: myself,
       }) => continuation({
         ['#findOptions']:
           (findOptions
-            ? {...findOptions, mode: 'quiet'}
-            : {mode: 'quiet'}),
+            ? {...findOptions, mode: 'quiet', from: myself}
+            : {mode: 'quiet', from: myself}),
       }),
     },
 
diff --git a/src/find.js b/src/find.js
index 5740ebd4..7b2ea7e0 100644
--- a/src/find.js
+++ b/src/find.js
@@ -288,6 +288,8 @@ function findHelper({
     // console.
     mode = 'warn',
 
+    from = null,
+
     fuzz = {
       capitalization: false,
       kebab: false,