mirror of https://github.com/logseq/logseq
fix: tests
parent
89efb99b71
commit
b0c03b0003
|
@ -22,9 +22,11 @@
|
|||
(let [id (:db/id m)
|
||||
children (-> (block-children id (inc level))
|
||||
(ldb/sort-by-order))]
|
||||
(->
|
||||
(assoc m
|
||||
:block/level level
|
||||
:block/children children)))
|
||||
:block/children children)
|
||||
(dissoc :block/parent :block/tx-id))))
|
||||
(sort-fn parent)))]
|
||||
(block-children root-id 1)))
|
||||
|
||||
|
|
|
@ -114,8 +114,8 @@
|
|||
repo (state/get-current-repo)
|
||||
block (if includeChildren
|
||||
;; nested children results
|
||||
(first (outliner-tree/blocks->vec-tree
|
||||
(db-model/get-block-and-children repo uuid) uuid))
|
||||
(let [blocks (db-model/get-block-and-children repo uuid)]
|
||||
(first (outliner-tree/blocks->vec-tree blocks uuid)))
|
||||
;; attached shallow children
|
||||
(assoc block :block/children
|
||||
(map #(list :uuid (:block/uuid %))
|
||||
|
|
|
@ -6,16 +6,21 @@
|
|||
[goog.object :as gobj]
|
||||
[cljs-bean.core :as bean]))
|
||||
|
||||
(defn- entity? [e]
|
||||
(when e (instance? de/Entity e)))
|
||||
(defn- entity->map
|
||||
"Convert a db Entity to a map"
|
||||
[e]
|
||||
(assert (de/entity? e))
|
||||
(assoc (into {} e) :db/id (:db/id e)))
|
||||
|
||||
(defn normalize-keyword-for-json
|
||||
([input] (normalize-keyword-for-json input true))
|
||||
([input camel-case?]
|
||||
(when input
|
||||
(let [input (cond
|
||||
(entity? input) (into {} input)
|
||||
(sequential? input) (map #(if (entity? %) (into {} %) %) input)
|
||||
(de/entity? input) (entity->map input)
|
||||
(sequential? input) (map #(if (de/entity? %)
|
||||
(entity->map %)
|
||||
%) input)
|
||||
:else input)]
|
||||
(walk/postwalk
|
||||
(fn [a]
|
||||
|
|
Loading…
Reference in New Issue