refactor: db based filters

Uses properties :logseq.property.linked-references/included-pages
and :logseq.property.linked-references/excluded-pages to store filters
instead of a map.

Fixes LOG-3074
This commit is contained in:
Tienson Qin
2024-06-08 03:13:39 +08:00
parent 7396176dd3
commit b2e113d8eb
9 changed files with 189 additions and 173 deletions

View File

@@ -87,10 +87,8 @@
[ref-blocks filters]
(if (empty? filters)
ref-blocks
(let [exclude-ids (->> (keep (fn [page] (:db/id (db/get-page page))) (get filters false))
(set))
include-ids (->> (keep (fn [page] (:db/id (db/get-page page))) (get filters true))
(set))]
(let [exclude-ids (set (map :db/id (:excluded filters)))
include-ids (set (map :db/id (:included filters)))]
(cond->> ref-blocks
(seq exclude-ids)
(remove (fn [block]