enhance: use db/ident for classes

allows built-in class names to change
pull/11055/head
Gabriel Horner 2024-03-15 09:22:35 -04:00
parent 55f6823ce8
commit 9cdf78ca6a
5 changed files with 6 additions and 8 deletions

View File

@ -110,6 +110,7 @@
(concat
[:map
[:block/namespace {:optional true} :int]
[:db/ident {:optional true} :keyword]
[:block/schema
{:optional true}
[:map

View File

@ -85,6 +85,7 @@
(cond->
{:block/original-name (or original-name k-name)
:block/name (common-util/page-name-sanity-lc k-name)
:db/ident (keyword "logseq.class" k-name)
:block/uuid (d/squuid)}
(seq properties)
(assoc-in [:block/schema :properties] properties)))))))

View File

@ -311,9 +311,7 @@
(common-marker/clean-marker content (get m :block/format :markdown))))
matched-status-id
(update :db/other-tx (fn [tx]
(if-let [task (d/entity @conn [:block/name "task"])]
(conj tx [:db/add (:db/id m) :block/tags (:db/id task)])
tx)))
(conj tx [:db/add (:db/id m) :block/tags :logseq.class/task])))
true
(dissoc :block/marker :block/priority)))

View File

@ -265,8 +265,7 @@
:block/refs refs}
;; Add task tag
(when status?
(when-let [task-id (:db/id (db-property/get-property (db/get-db repo) "task"))]
[:db/add (:db/id block) :block/tags task-id]))]]
[:db/add (:db/id block) :block/tags :logseq.class/task])]]
(db/transact! repo tx-data {:outliner-op :save-block}))))))))))))
(defn- convert-one-to-many-values!
@ -405,8 +404,7 @@
:block/properties block-properties
:block/refs refs}
(when status?
(when-let [task-id (:db/id (db-property/get-property (db/get-db repo) "task"))]
[:db/add (:db/id block) :block/tags task-id]))]))))
[:db/add (:db/id block) :block/tags :logseq.class/task])]))))
block-ids)]
(when (seq txs)
(db/transact! repo txs {:outliner-op :save-block}))))

View File

@ -642,7 +642,7 @@
(defn db-based-cycle-todo!
[block]
(let [task (db/entity [:block/name "task"])
(let [task (db/entity :logseq.class/task)
status-id (:block/uuid (db/entity :task/status))
status-value-id (get-in block [:block/properties status-id])
status-value (when status-value-id (db/entity [:block/uuid status-value-id]))