浏览代码

fix: two db importer bugs introduced last week

- Graphs with description page failed to import
- Graphs that had a page with a built-in class name mangled the block
  types. Reverted fix for logseq/db-test#17
- Also updated test for datom count as some parser changes were made
  last week to alter it
Gabriel Horner 1 年之前
父节点
当前提交
658ea25a21

+ 1 - 3
deps/graph-parser/src/logseq/graph_parser/block.cljs

@@ -362,9 +362,7 @@
                                                 nil)]
                                                 nil)]
                                  [page nil]))]
                                  [page nil]))]
       (when page
       (when page
-        (let [type (if class? "class" (or (:block/type page-entity)
-                                          (:block/type page)
-                                          "page"))]
+        (let [type (if class? "class" (or (:block/type page) "page"))]
           (assoc page :block/type type))))))
           (assoc page :block/type type))))))
 
 
 (defn- with-page-refs-and-tags
 (defn- with-page-refs-and-tags

+ 1 - 1
deps/graph-parser/src/logseq/graph_parser/exporter.cljs

@@ -852,7 +852,7 @@
         [properties-tx pages-tx'] ((juxt filter remove)
         [properties-tx pages-tx'] ((juxt filter remove)
                                    #(contains? new-properties (keyword (:block/name %))) pages-tx)
                                    #(contains? new-properties (keyword (:block/name %))) pages-tx)
         property-pages-tx (map (fn [{:block/keys [title uuid]}]
         property-pages-tx (map (fn [{:block/keys [title uuid]}]
-                                 (let [db-ident (get @(:all-idents import-state) (keyword title))]
+                                 (let [db-ident (get @(:all-idents import-state) (keyword (string/lower-case title)))]
                                    (sqlite-util/build-new-property db-ident
                                    (sqlite-util/build-new-property db-ident
                                                                    (get @(:property-schemas import-state) (keyword title))
                                                                    (get @(:property-schemas import-state) (keyword title))
                                                                    {:title title :block-uuid uuid})))
                                                                    {:title title :block-uuid uuid})))

+ 1 - 1
deps/graph-parser/test/logseq/graph_parser/cli_test.cljs

@@ -14,7 +14,7 @@
     (docs-graph-helper/docs-graph-assertions @conn graph-dir files)
     (docs-graph-helper/docs-graph-assertions @conn graph-dir files)
 
 
     (testing "Additional counts"
     (testing "Additional counts"
-      (is (= 57836 (count (d/datoms @conn :eavt))) "Correct datoms count"))
+      (is (= 57882 (count (d/datoms @conn :eavt))) "Correct datoms count"))
 
 
     (testing "Asts"
     (testing "Asts"
       (is (seq asts) "Asts returned are non-zero")
       (is (seq asts) "Asts returned are non-zero")