fix: parent refs are not included in filters

related to #6490
This commit is contained in:
Tienson Qin
2022-08-29 07:47:57 +08:00
parent 0fce4a4792
commit b6ecc7f6e3

View File

@@ -248,18 +248,17 @@
(reset! *swipe nil))
(defn get-blocks-refed-pages
[aliases ref-blocks]
(let [refs (->> (mapcat :block/refs ref-blocks)
(remove #(aliases (:db/id %))))
pages (->> (map :block/page ref-blocks)
(distinct)
(remove #(aliases (:db/id %))))
all-refs (concat pages refs)]
[aliases [block & children]]
(let [children-refs (mapcat :block/refs children)
refs (->>
(:block/path-refs block)
(concat children-refs)
(remove #(aliases (:db/id %))))]
(keep (fn [ref]
(when (:block/name ref)
{:db/id (:db/id ref)
:block/name (:block/name ref)
:block/original-name (:block/original-name ref)})) all-refs)))
:block/original-name (:block/original-name ref)})) refs)))
(defn filter-blocks
[ref-blocks filters]