mirror of
https://github.com/logseq/logseq.git
synced 2026-06-01 19:01:22 +00:00
fix(journals): hide recycled journals and refresh list on recycle
This commit is contained in:
@@ -31,9 +31,16 @@
|
||||
|
||||
(s/def ::affected-keys (s/coll-of ::react-query-keys))
|
||||
|
||||
(defn- journal-page?
|
||||
[db eid journal-tag-id]
|
||||
(when (and db eid journal-tag-id)
|
||||
(some (fn [tag]
|
||||
(= journal-tag-id (:db/id tag)))
|
||||
(:block/tags (d/entity db eid)))))
|
||||
|
||||
(defn get-affected-queries-keys
|
||||
"Get affected queries through transaction datoms."
|
||||
[{:keys [tx-data db-after]}]
|
||||
[{:keys [tx-data db-before db-after]}]
|
||||
{:post [(s/valid? ::affected-keys %)]}
|
||||
(let [blocks (->> (filter (fn [datom] (contains? #{:block/parent :block/page} (:a datom))) tx-data)
|
||||
(map :v)
|
||||
@@ -47,12 +54,19 @@
|
||||
tags (->> (filter (fn [datom] (= :block/tags (:a datom))) tx-data)
|
||||
(map :v)
|
||||
(distinct))
|
||||
journals? (some (fn [datom]
|
||||
(and
|
||||
(= :block/tags (:a datom))
|
||||
(= (:db/id (d/entity db-after :logseq.class/Journal))
|
||||
(:v datom))))
|
||||
tx-data)
|
||||
journal-tag-id (:db/id (d/entity db-after :logseq.class/Journal))
|
||||
touched-eids (->> tx-data (map :e) distinct)
|
||||
journals? (or (some (fn [datom]
|
||||
(and (= :block/tags (:a datom))
|
||||
(= journal-tag-id (:v datom))))
|
||||
tx-data)
|
||||
(some (fn [datom]
|
||||
(= :block/journal-day (:a datom)))
|
||||
tx-data)
|
||||
(some (fn [eid]
|
||||
(or (journal-page? db-before eid journal-tag-id)
|
||||
(journal-page? db-after eid journal-tag-id)))
|
||||
touched-eids))
|
||||
reaction-targets (->> (filter (fn [datom]
|
||||
(= :logseq.property.reaction/target (:a datom))) tx-data)
|
||||
(map :v)
|
||||
|
||||
Reference in New Issue
Block a user