File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 136136 (merge (:build/properties v)
137137 {:block/tags (mapv #(hash-map :db/ident (get-ident all-idents %))
138138 (:build/tags v))}
139- (select-keys v [:block/created-at :block/updated-at ])))]
139+ (select-keys v [:block/created-at :block/updated-at :block/uuid ])))]
140140 (cond-> property-map
141141 (and (:build/property-value v) (seq pvalue-attrs))
142142 (assoc :property-value-properties pvalue-attrs)))
Original file line number Diff line number Diff line change 199199 (assoc :build/class-extends
200200 (mapv :db/ident (:logseq.property.class/extends class-ent)))))
201201
202+ (defn block-property-value? [%]
203+ (and (map? %) (:build/property-value %)))
204+
202205(defn- build-node-classes
203206 [db build-block block-tags properties]
204207 (let [pvalue-classes (->> (:build/properties build-block)
205208 vals
206209 (mapcat (fn [val-or-vals]
207- (mapcat #(when (sqlite-build/page-prop-value? %) (:build/tags (second %)))
210+ (mapcat #(cond (sqlite-build/page-prop-value? %)
211+ (:build/tags (second %))
212+ (block-property-value? %)
213+ (:build/tags %))
208214 (if (set? val-or-vals) val-or-vals [val-or-vals]))))
209215 (remove db-class/logseq-class?))
210216 property-classes (->> (mapcat :build/property-classes (vals properties))
737743 ; ; TODO: Walk data structure via :build/properties instead of slower walk
738744 page-map'
739745 (walk/postwalk (fn [f]
740- (if (and ( map? f) ( :build/ property-value f) )
746+ (if (block- property-value? f )
741747 (remove-uuid-if-not-ref f)
742748 f))
743749 page-map)]
823829(defn- find-undefined-uuids [db {:keys [classes properties pages-and-blocks]}]
824830 (let [pvalue-known-uuids (atom #{})
825831 _ (walk/postwalk (fn [f]
826- (if (and (map? f) ( :build/ property-value f) (:block/uuid f))
832+ (if (and (block- property-value? f) (:block/uuid f))
827833 (swap! pvalue-known-uuids conj (:block/uuid f))
828834 f))
829835 pages-and-blocks)
Original file line number Diff line number Diff line change 271271 class-uuid (random-uuid )
272272 page-uuid (random-uuid )
273273 pvalue-page-uuid (random-uuid )
274+ pvalue-block-uuid (random-uuid )
274275 property-uuid (random-uuid )
275276 journal-uuid (random-uuid )
276277 block-object-uuid (random-uuid )
277278 original-data
278279 {:classes {:user.class/C1 {:block/uuid class-uuid :build/keep-uuid? true }
280+ :user.class/C2 {}
279281 :user.class/NodeClass {}}
280282 :properties {:user.property/p1
281283 {:logseq.property/type :node
297299 {:block/title (str " class ref to " (page-ref/->page-ref class-uuid))}
298300 {:block/title (str " inline class ref to #" (page-ref/->page-ref class-uuid))}
299301 {:block/title (str " property ref to " (page-ref/->page-ref property-uuid))}
300- {:block/title (str " journal ref to " (page-ref/->page-ref journal-uuid))}]}
302+ {:block/title (str " journal ref to " (page-ref/->page-ref journal-uuid))}
303+ {:block/title (str " property block value ref to " (page-ref/->page-ref pvalue-block-uuid))}
304+ {:block/title " block with a pvalue that has a :block/uuid"
305+ :build/properties {:user.property/p2 {:build/property-value :block
306+ :block/title " property value block"
307+ :build/tags [:user.class/C2 ]
308+ :block/uuid pvalue-block-uuid
309+ :build/keep-uuid? true }}}]}
301310 {:page {:block/title " page with block ref" }
302311 :blocks [{:block/title " hi" :block/uuid block-uuid :build/keep-uuid? true
303312 :build/properties {:user.property/p1 [:block/uuid block-object-uuid]}}]}
You can’t perform that action at this time.
0 commit comments