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