Преглед на файлове

enhance: use db/ident for classes

allows built-in class names to change
Gabriel Horner преди 1 година
родител
ревизия
9cdf78ca6a

+ 1 - 0
deps/db/src/logseq/db/frontend/malli_schema.cljs

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

+ 1 - 0
deps/db/src/logseq/db/sqlite/create_graph.cljs

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

+ 1 - 3
deps/outliner/src/logseq/outliner/core.cljs

@@ -311,9 +311,7 @@
                                 (common-marker/clean-marker content (get m :block/format :markdown))))
                                 (common-marker/clean-marker content (get m :block/format :markdown))))
        matched-status-id
        matched-status-id
        (update :db/other-tx (fn [tx]
        (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
        true
        (dissoc :block/marker :block/priority)))
        (dissoc :block/marker :block/priority)))

+ 2 - 4
src/main/frontend/handler/db_based/property.cljs

@@ -265,8 +265,7 @@
                                     :block/refs refs}
                                     :block/refs refs}
                                    ;; Add task tag
                                    ;; Add task tag
                                    (when status?
                                    (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}))))))))))))
                       (db/transact! repo tx-data {:outliner-op :save-block}))))))))))))
 
 
 (defn- convert-one-to-many-values!
 (defn- convert-one-to-many-values!
@@ -405,8 +404,7 @@
                        :block/properties block-properties
                        :block/properties block-properties
                        :block/refs refs}
                        :block/refs refs}
                       (when status?
                       (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)]
              block-ids)]
     (when (seq txs)
     (when (seq txs)
       (db/transact! repo txs {:outliner-op :save-block}))))
       (db/transact! repo txs {:outliner-op :save-block}))))

+ 1 - 1
src/main/frontend/handler/editor.cljs

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