enhance: all journal pages have #Journal class

Also add some support for importer to do the same
pull/11506/head
Gabriel Horner 2024-09-06 18:27:58 -04:00
parent 25b1732de8
commit 39b0e3e368
4 changed files with 28 additions and 17 deletions

View File

@ -465,7 +465,8 @@
:block/title page-name
:block/uuid
(common-uuid/gen-uuid :journal-page-uuid date-int)
:block/type "journal"})))))
:block/type "journal"
:block/tags :logseq.class/Journal})))))
m))]
;; Order matters as some steps depend on previous step having prepared blocks or pages in a certain way
(->> pages-and-blocks

View File

@ -350,8 +350,10 @@
{:block/created-at current-ms
:block/updated-at current-ms}))
(if journal-day
{:block/type "journal"
(cond-> {:block/type "journal"
:block/journal-day journal-day}
db-based?
(assoc :block/tags [:logseq.class/Journal]))
{}))]
[page page-entity])

View File

@ -83,7 +83,10 @@
[block db tag-classes page-names-to-uuids all-idents]
(if (seq (:block/tags block))
(let [page-tags (->> (:block/tags block)
(remove #(or (:block.temp/new-class %) (contains? tag-classes (:block/name %))))
(remove #(or (:block.temp/new-class %)
(contains? tag-classes (:block/name %))
;; Ignore new class tags from extract
(= % :logseq.class/Journal)))
(map #(vector :block/uuid (get-page-uuid page-names-to-uuids (:block/name %))))
set)]
(cond-> block
@ -190,7 +193,8 @@
:in $ ?journal-day
:where [?b :block/journal-day ?journal-day]]
db date-int))
deadline-page (or existing-journal-page
deadline-page (->
(or existing-journal-page
;; FIXME: Register new pages so that two different refs to same new page
;; don't create different uuids and thus an invalid page
(let [page-m (sqlite-util/build-new-page
@ -198,7 +202,8 @@
(assoc page-m
:block/uuid (common-uuid/gen-uuid :journal-page-uuid date-int)
:block/type "journal"
:block/journal-day date-int)))]
:block/journal-day date-int)))
(assoc :block/tags :logseq.class/Journal))]
{:block
(-> block
(assoc :logseq.task/deadline [:block/uuid (:block/uuid deadline-page)])

View File

@ -18,12 +18,15 @@
whiteboard? "whiteboard"
(:block/type page) (:block/type page)
:else "page"))
page' (merge page
(when tags {:block/tags (mapv (fn [tag]
page' (cond-> page
(seq tags)
(update :block/tags
(fnil into [])
(mapv (fn [tag]
(if (uuid? tag)
(d/entity @conn [:block/uuid tag])
tag))
tags)}))
tags)))
property-vals-tx-m
;; Builds property values for built-in properties like logseq.property.pdf/file
(db-property-build/build-property-values-tx-m