Loosen property name check for db graphs

properties don't need to be keywords for db graphs since property names
aren't involved in property storage. This change allows for property
names to have whitespace and be invalid edn.

See #6753 for example bugs that db-validation-property-name? catches
This commit is contained in:
Gabriel Horner
2023-08-03 16:57:54 -04:00
parent 8253477a9d
commit 6537f0dfab
2 changed files with 16 additions and 10 deletions

View File

@@ -338,7 +338,7 @@
(let [editor-id (str "ls-property-" blocks-container-id (:db/id entity) "-" (:db/id property))]
(set-editing! property editor-id "" ""))))
;; new property
(if (gp-property/valid-property-name? (str ":" property-name))
(if (gp-property/db-valid-property-name? property-name)
(if (= "class" (:block/type entity))
(add-property! entity property-name "" {:class-schema? class-schema?})
(do
@@ -346,7 +346,7 @@
;; configure new property
(when-let [property (get-property-from-db property-name)]
(state/set-sub-modal! #(property-config repo property)))))
(do (notification/show! "This is an invalid property name. A property name cannot start with non-alphanumeric characters e.g. '#' or '[['." :error)
(do (notification/show! "This is an invalid property name. A property name cannot start with page reference characters '#' or '[['." :error)
(exit-edit-property))))))
(rum/defcs property-input < rum/reactive