enhance: add created-by prop to blocks

This commit is contained in:
rcmerci
2025-01-14 14:57:33 +08:00
parent 685e82502b
commit 3e025dd311
6 changed files with 52 additions and 29 deletions

View File

@@ -369,7 +369,7 @@
as there's no chance to introduce timestamps via editing in page
`skip-existing-page-check?`: if true, allows pages to have the same name"
[original-page-name db with-timestamp? date-formatter
& {:keys [page-uuid class?] :as options}]
& {:keys [page-uuid class? created-by] :as options}]
(when-not (and db (common-util/uuid-string? original-page-name)
(not (ldb/page? (d/entity db [:block/uuid (uuid original-page-name)]))))
(let [original-page-name (-> (string/trim original-page-name)
@@ -393,7 +393,8 @@
(let [tags (if class? [:logseq.class/Tag]
(or (:block/tags page)
[:logseq.class/Page]))]
(assoc page :block/tags tags))
(cond-> (assoc page :block/tags tags)
created-by (assoc :logseq.property/created-by created-by)))
(assoc page :block/type (or (:block/type page) "page")))))))
(defn- db-namespace-page?