Fix property rules for advanced queries with db graphs

and provide a rules var just for db graphs.
Also simplify query-dsl db-graph support as query-dsl/parse-query
doesn't need to know about db graphs for how it's used
This commit is contained in:
Gabriel Horner
2023-07-25 13:49:25 -04:00
parent 01ff0e9a16
commit e9fecfa280
9 changed files with 79 additions and 73 deletions

View File

@@ -3253,7 +3253,7 @@
(defn- valid-dsl-query-block?
"Whether block has a valid dsl query."
[repo block]
[block]
(->> (:block/macros (db/entity (:db/id block)))
(some (fn [macro]
(when-let [query-body (and
@@ -3261,7 +3261,7 @@
(first (:logseq.macro-arguments (:block/properties macro))))]
(seq (:query
(try
(query-dsl/parse-query query-body (config/db-based-graph? repo))
(query-dsl/parse-query query-body)
(catch :default _e
nil)))))))))
@@ -3284,7 +3284,7 @@
(when block-id
(if-let [block (db-model/query-block-by-uuid block-id)]
(or (db-model/has-children? block-id)
(valid-dsl-query-block? (state/get-current-repo) block)
(valid-dsl-query-block? block)
(valid-custom-query-block? block)
(and
(:outliner/block-title-collapse-enabled? (state/get-config))