« get me outta code hell

make commentary a Thing.common prop - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2022-05-12 19:04:13 -0300
committer(quasar) nebula <qznebula@protonmail.com>2022-05-12 19:04:13 -0300
commit6f9e037670476a0829c133872ab3271a0f29de47 (patch)
tree778a565fb45d0feddb95d5e70082f2242a19a7a5
parentf48e0b99c7249682b328194fc70e5a4e3f11d2e1 (diff)
make commentary a Thing.common prop
-rw-r--r--src/data/things.js17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/data/things.js b/src/data/things.js
index 8535830..0695b0d 100644
--- a/src/data/things.js
+++ b/src/data/things.js
@@ -201,6 +201,12 @@ Thing.common = {
         update: {validate: isContributionList}
     }),
 
+    // Artist commentary! Generally present on tracks and albums.
+    commentary: () => ({
+        flags: {update: true, expose: true},
+        update: {validate: isCommentary}
+    }),
+
     // A reference list! Keep in mind this is for general references to wiki
     // objects of (usually) other Thing subclasses, not specifically leitmotif
     // references in tracks (although that property uses referenceList too!).
@@ -490,10 +496,7 @@ Album.propertyDescriptors = {
     isMajorRelease: Thing.common.flag(false),
     isListedOnHomepage: Thing.common.flag(true),
 
-    commentary: {
-        flags: {update: true, expose: true},
-        update: {validate: isCommentary}
-    },
+    commentary: Thing.common.commentary(),
 
     // Update only
 
@@ -707,11 +710,7 @@ Track.propertyDescriptors = {
 
     dataSourceAlbumByRef: Thing.common.singleReference(Album),
 
-    commentary: {
-        flags: {update: true, expose: true},
-        update: {validate: isCommentary}
-    },
-
+    commentary: Thing.common.commentary(),
     lyrics: Thing.common.simpleString(),
 
     // Update only