mirror of
https://github.com/logseq/logseq.git
synced 2026-06-01 19:01:22 +00:00
fix: add pre-configured properties when creating a new db graph
This commit is contained in:
@@ -804,19 +804,26 @@
|
||||
[block-id all-properties key add?]
|
||||
(when-let [block (db/entity [:block/uuid block-id])]
|
||||
(let [properties (:block/properties block)
|
||||
query-properties (or (pu/lookup properties :query-properties) "")
|
||||
query-properties (-> query-properties
|
||||
(common-handler/safe-read-string "Failed to parse query properties"))
|
||||
query-properties (pu/lookup properties :query-properties)
|
||||
repo (state/get-current-repo)
|
||||
db-based? (config/db-based-graph? repo)
|
||||
query-properties (if db-based?
|
||||
query-properties
|
||||
(some-> query-properties
|
||||
(common-handler/safe-read-string "Parsing query properties failed")))
|
||||
query-properties (if (seq query-properties)
|
||||
query-properties
|
||||
all-properties)
|
||||
query-properties (if add?
|
||||
(distinct (conj query-properties key))
|
||||
(remove #{key} query-properties))
|
||||
query-properties (vec query-properties)
|
||||
repo (state/get-current-repo)]
|
||||
query-properties (vec query-properties)]
|
||||
(if (seq query-properties)
|
||||
(property-handler/set-block-property! repo block-id :query-properties (str query-properties))
|
||||
(property-handler/set-block-property! repo block-id
|
||||
:query-properties
|
||||
(if db-based?
|
||||
query-properties
|
||||
(str query-properties)))
|
||||
(property-handler/remove-block-property! repo block-id :query-properties)))))
|
||||
|
||||
(defn set-block-timestamp!
|
||||
|
||||
Reference in New Issue
Block a user