fix: db graphs not adding :block/content for whiteboard shape

Caused by hopefully one of the last incorrect lookups of
:block/properties
pull/10838/head
Gabriel Horner 2024-01-08 16:16:07 -05:00
parent ce37f4777e
commit 6ad5fb2dd4
5 changed files with 8 additions and 7 deletions

View File

@ -227,7 +227,8 @@
(vec
(concat
[:map]
[[:block/parent :int]
[[:block/content :string]
[:block/parent :int]
;; These blocks only associate with pages of type "whiteboard"
[:block/page :int]]
page-or-block-attrs)))

View File

@ -25,8 +25,6 @@ logseq.graph-parser.util/unquote-string
;; API
logseq.graph-parser.util.page-ref/page-ref-re
;; API
logseq.graph-parser.whiteboard/page-block->tldr-page
;; API
logseq.graph-parser/get-blocks-to-delete
;; API
logseq.graph-parser.util.db/resolve-input

View File

@ -7,9 +7,6 @@
(defn block->shape [block]
(get-in block [:block/properties :logseq.tldraw.shape]))
(defn page-block->tldr-page [block]
(get-in block [:block/properties :logseq.tldraw.page]))
(defn shape-block? [block]
(= :whiteboard-shape (get-in block [:block/properties :ls-type])))
@ -74,6 +71,8 @@
(str "whiteboard " (:type shape)))})
(defn with-whiteboard-block-props
"Builds additional block attributes for a whiteboard block. Expects :block/properties
to be in file graph format"
[block page-name]
(let [shape? (shape-block? block)
shape (block->shape block)

View File

@ -144,6 +144,7 @@
page-block (db/entity [:block/name page-name])]
;; Missing support for per block format (or deprecated?)
(try (if whiteboard?
;; only works for file graph :block/properties
(let [blocks (->> children
(map (partial medley/map-keys (fn [k] (keyword "block" k))))
(map gp-whiteboard/migrate-shape-block)

View File

@ -34,7 +34,9 @@
:block/page {:block/name (util/page-name-sanity-lc page-name)}
:block/parent {:block/name page-name}
:block/properties properties}
additional-props (gp-whiteboard/with-whiteboard-block-props block page-name)]
additional-props (gp-whiteboard/with-whiteboard-block-props
(assoc block :block/properties {:ls-type :whiteboard-shape :logseq.tldraw.shape shape})
page-name)]
(merge block additional-props)))
(defn- build-shapes