浏览代码

refactor: update :block/type to cardinality one instead of many

Tienson Qin 1 年之前
父节点
当前提交
d26e620a82
共有 47 个文件被更改,包括 243 次插入261 次删除
  1. 2 2
      deps/db/script/validate_client_db.cljs
  2. 11 11
      deps/db/src/logseq/db.cljs
  3. 6 13
      deps/db/src/logseq/db/frontend/malli_schema.cljs
  4. 1 1
      deps/db/src/logseq/db/frontend/property/build.cljs
  5. 1 1
      deps/db/src/logseq/db/frontend/property/type.cljs
  6. 1 2
      deps/db/src/logseq/db/frontend/schema.cljs
  7. 2 2
      deps/db/src/logseq/db/sqlite/build.cljs
  8. 1 1
      deps/db/src/logseq/db/sqlite/common_db.cljs
  9. 2 2
      deps/db/src/logseq/db/sqlite/create_graph.cljs
  10. 5 4
      deps/db/src/logseq/db/sqlite/util.cljs
  11. 2 2
      deps/db/test/logseq/db/sqlite/build_test.cljs
  12. 3 3
      deps/db/test/logseq/db/sqlite/create_graph_test.cljs
  13. 3 7
      deps/graph-parser/src/logseq/graph_parser/block.cljs
  14. 3 4
      deps/graph-parser/src/logseq/graph_parser/exporter.cljs
  15. 3 3
      deps/graph-parser/src/logseq/graph_parser/extract.cljc
  16. 5 5
      deps/graph-parser/test/logseq/graph_parser/exporter_test.cljs
  17. 1 1
      deps/graph-parser/test/logseq/graph_parser/extract_test.cljs
  18. 1 1
      deps/graph-parser/test/logseq/graph_parser_test.cljs
  19. 0 0
      deps/graph-parser/test/resources/exporter-test-graph/whiteboards/Test Whiteboard.edn
  20. 125 127
      deps/graph-parser/test/resources/exporter-test-graph/whiteboards/block tests.edn
  21. 1 1
      deps/graph-parser/test/resources/exporter-test-graph/whiteboards/publishing test.edn
  22. 4 4
      deps/outliner/src/logseq/outliner/property.cljs
  23. 1 1
      src/main/frontend/common_keywords.cljs
  24. 2 2
      src/main/frontend/components/all_pages.cljs
  25. 11 11
      src/main/frontend/components/db_based/page.cljs
  26. 2 2
      src/main/frontend/components/imports.cljs
  27. 1 1
      src/main/frontend/components/page.cljs
  28. 1 1
      src/main/frontend/components/page_menu.cljs
  29. 4 4
      src/main/frontend/components/property.cljs
  30. 2 2
      src/main/frontend/components/property/value.cljs
  31. 1 1
      src/main/frontend/components/right_sidebar.cljs
  32. 1 1
      src/main/frontend/handler/editor.cljs
  33. 7 7
      src/main/frontend/handler/page.cljs
  34. 3 3
      src/main/frontend/handler/whiteboard.cljs
  35. 5 3
      src/main/frontend/worker/db/migrate.cljs
  36. 1 1
      src/main/frontend/worker/export.cljs
  37. 1 1
      src/main/frontend/worker/file.cljs
  38. 1 1
      src/main/frontend/worker/file/core.cljs
  39. 1 1
      src/main/frontend/worker/handler/page.cljs
  40. 1 2
      src/main/frontend/worker/handler/page/db_based/page.cljs
  41. 1 1
      src/main/frontend/worker/handler/page/file_based/page.cljs
  42. 2 2
      src/main/frontend/worker/handler/page/file_based/rename.cljs
  43. 1 1
      src/main/frontend/worker/rtc/asset_db_listener.cljs
  44. 3 4
      src/main/frontend/worker/rtc/db_listener.cljs
  45. 3 7
      src/main/frontend/worker/rtc/remote_update.cljs
  46. 2 2
      src/main/frontend/worker/search.cljs
  47. 2 2
      src/test/frontend/worker/rtc/client_test.cljs

+ 2 - 2
deps/db/script/validate_client_db.cljs

@@ -81,9 +81,9 @@
                                (count ent-maps) " entities, "
                                (count ent-maps) " entities, "
                                (count (filter :block/name ent-maps)) " pages, "
                                (count (filter :block/name ent-maps)) " pages, "
                                (count (filter :block/title ent-maps)) " blocks, "
                                (count (filter :block/title ent-maps)) " blocks, "
-                               (count (filter #(contains? (:block/type %) "class") ent-maps)) " classes, "
+                               (count (filter #(= (:block/type %) "class") ent-maps)) " classes, "
                                (count (filter #(seq (:block/tags %)) ent-maps)) " objects, "
                                (count (filter #(seq (:block/tags %)) ent-maps)) " objects, "
-                               (count (filter #(contains? (:block/type %) "property") ent-maps)) " properties and "
+                               (count (filter #(= (:block/type %) "property") ent-maps)) " properties and "
                                (count (mapcat db-property/properties ent-maps)) " property pairs"))
                                (count (mapcat db-property/properties ent-maps)) " property pairs"))
     (validate-client-db @conn ent-maps options)))
     (validate-client-db @conn ent-maps options)))
 
 

+ 11 - 11
deps/db/src/logseq/db.cljs

@@ -103,12 +103,12 @@
 (defn whiteboard-page?
 (defn whiteboard-page?
   "Given a page entity or map, check if it is a whiteboard page"
   "Given a page entity or map, check if it is a whiteboard page"
   [page]
   [page]
-  (contains? (set (:block/type page)) "whiteboard"))
+  (= (:block/type page) "whiteboard"))
 
 
 (defn journal-page?
 (defn journal-page?
   "Given a page entity or map, check if it is a journal page"
   "Given a page entity or map, check if it is a journal page"
   [page]
   [page]
-  (contains? (set (:block/type page)) "journal"))
+  (= (:block/type page) "journal"))
 
 
 (defn get-page-blocks
 (defn get-page-blocks
   "Return blocks of the designated page, without using cache.
   "Return blocks of the designated page, without using cache.
@@ -171,7 +171,7 @@
     (if (string? page)
     (if (string? page)
       (or (string/starts-with? page "$$$")
       (or (string/starts-with? page "$$$")
           (= common-config/favorites-page-name page))
           (= common-config/favorites-page-name page))
-      (contains? (set (:block/type page)) "hidden"))))
+      (= (:block/type page) "hidden"))))
 
 
 (defn get-pages
 (defn get-pages
   [db]
   [db]
@@ -249,7 +249,7 @@
                                 (not (contains? built-in-pages name))
                                 (not (contains? built-in-pages name))
                                 (not (whiteboard-page? page))
                                 (not (whiteboard-page? page))
                                 (not (:block/_namespace page))
                                 (not (:block/_namespace page))
-                                (not (contains? (:block/type page) "property"))
+                                (not (= (:block/type page) "property"))
                                  ;; a/b/c might be deleted but a/b/c/d still exists (for backward compatibility)
                                  ;; a/b/c might be deleted but a/b/c/d still exists (for backward compatibility)
                                 (not (and (string/includes? name "/")
                                 (not (and (string/includes? name "/")
                                           (not (journal-page? page))))
                                           (not (journal-page? page))))
@@ -448,7 +448,7 @@
   "Whether property a built-in property for the specific class"
   "Whether property a built-in property for the specific class"
   [class-entity property-entity]
   [class-entity property-entity]
   (and (built-in? class-entity)
   (and (built-in? class-entity)
-       (contains? (:block/type class-entity) "class")
+       (= (:block/type class-entity) "class")
        (built-in? property-entity)
        (built-in? property-entity)
        (contains? (set (map :db/ident (:class/schema.properties class-entity)))
        (contains? (set (map :db/ident (:class/schema.properties class-entity)))
                   (:db/ident property-entity))))
                   (:db/ident property-entity))))
@@ -466,7 +466,7 @@
      {:block/uuid (common-uuid/gen-uuid)
      {:block/uuid (common-uuid/gen-uuid)
       :block/name common-config/favorites-page-name
       :block/name common-config/favorites-page-name
       :block/title common-config/favorites-page-name
       :block/title common-config/favorites-page-name
-      :block/type #{"page" "hidden"}
+      :block/type "hidden"
       :block/format :markdown})]))
       :block/format :markdown})]))
 
 
 (defn build-favorite-tx
 (defn build-favorite-tx
@@ -486,7 +486,7 @@
        {:block/uuid page-id
        {:block/uuid page-id
         :block/name common-config/views-page-name
         :block/name common-config/views-page-name
         :block/title common-config/views-page-name
         :block/title common-config/views-page-name
-        :block/type #{"page" "hidden"}
+        :block/type "hidden"
         :block/format :markdown})
         :block/format :markdown})
       (sqlite-util/block-with-timestamps
       (sqlite-util/block-with-timestamps
        {:block/uuid (common-uuid/gen-uuid)
        {:block/uuid (common-uuid/gen-uuid)
@@ -506,13 +506,13 @@
 (def page? sqlite-util/page?)
 (def page? sqlite-util/page?)
 (defn class?
 (defn class?
   [entity]
   [entity]
-  (contains? (:block/type entity) "class"))
+  (= (:block/type entity) "class"))
 (defn property?
 (defn property?
   [entity]
   [entity]
-  (contains? (:block/type entity) "property"))
+  (= (:block/type entity) "property"))
 (defn closed-value?
 (defn closed-value?
   [entity]
   [entity]
-  (contains? (:block/type entity) "closed value"))
+  (= (:block/type entity) "closed value"))
 
 
 (def db-based-graph? entity-plus/db-based-graph?)
 (def db-based-graph? entity-plus/db-based-graph?)
 
 
@@ -562,7 +562,7 @@
       (loop [current-parent parent]
       (loop [current-parent parent]
         (when (and
         (when (and
                current-parent
                current-parent
-               (contains? (:block/type parent) "class")
+               (= (:block/type parent) "class")
                (not (contains? @*classes (:db/id parent))))
                (not (contains? @*classes (:db/id parent))))
           (swap! *classes conj (:db/id current-parent))
           (swap! *classes conj (:db/id current-parent))
           (recur (:class/parent current-parent)))))
           (recur (:class/parent current-parent)))))

+ 6 - 13
deps/db/src/logseq/db/frontend/malli_schema.cljs

@@ -214,7 +214,7 @@
   "Common attributes for pages"
   "Common attributes for pages"
   [[:block/name :string]
   [[:block/name :string]
    [:block/title :string]
    [:block/title :string]
-   [:block/type [:set [:enum "page" "class" "property" "whiteboard" "journal" "hidden"]]]
+   [:block/type [:enum "page" "class" "property" "whiteboard" "journal" "hidden"]]
    [:block/alias {:optional true} [:set :int]]
    [:block/alias {:optional true} [:set :int]]
     ;; TODO: Should this be here or in common?
     ;; TODO: Should this be here or in common?
    [:block/path-refs {:optional true} [:set :int]]
    [:block/path-refs {:optional true} [:set :int]]
@@ -366,7 +366,7 @@
   (vec
   (vec
    (concat
    (concat
     [:map]
     [:map]
-    [[:block/type [:= #{"closed value"}]]
+    [[:block/type [:= "closed value"]]
      ;; for built-in properties
      ;; for built-in properties
      [:db/ident {:optional true} logseq-property-ident]
      [:db/ident {:optional true} logseq-property-ident]
      [:block/title {:optional true} :string]
      [:block/title {:optional true} :string]
@@ -429,24 +429,17 @@
    [:db/ident [:= :logseq.property/empty-placeholder]]
    [:db/ident [:= :logseq.property/empty-placeholder]]
    [:block/tx-id {:optional true} :int]])
    [:block/tx-id {:optional true} :int]])
 
 
-(defn- type-set
-  [d]
-  (when-let [type (:block/type d)]
-    (if (coll? type)
-      (set type)
-      #{type})))
-
 (def Data
 (def Data
   (into
   (into
    [:multi {:dispatch (fn [d]
    [:multi {:dispatch (fn [d]
                         (cond
                         (cond
-                          (contains? (type-set d) "property")
+                          (= (:block/type d) "property")
                           :property
                           :property
-                          (contains? (type-set d) "class")
+                          (= (:block/type d) "class")
                           :class
                           :class
-                          (contains? (type-set d) "hidden")
+                          (= (:block/type d) "hidden")
                           :hidden
                           :hidden
-                          (contains? (type-set d) "whiteboard")
+                          (= (:block/type d) "whiteboard")
                           :normal-page
                           :normal-page
                           (sqlite-util/page? d)
                           (sqlite-util/page? d)
                           :normal-page
                           :normal-page

+ 1 - 1
deps/db/src/logseq/db/frontend/property/build.cljs

@@ -8,7 +8,7 @@
 (defn- closed-value-new-block
 (defn- closed-value-new-block
   [block-id value property]
   [block-id value property]
   (let [property-id (:db/ident property)]
   (let [property-id (:db/ident property)]
-    (merge {:block/type #{"closed value"}
+    (merge {:block/type "closed value"
             :block/format :markdown
             :block/format :markdown
             :block/uuid block-id
             :block/uuid block-id
             :block/page property-id
             :block/page property-id

+ 1 - 1
deps/db/src/logseq/db/frontend/property/type.cljs

@@ -126,7 +126,7 @@
   [db val]
   [db val]
   (when-let [ent (d/entity db val)]
   (when-let [ent (d/entity db val)]
     (and (some? (:block/title ent))
     (and (some? (:block/title ent))
-         (contains? (:block/type ent) "journal"))))
+         (= (:block/type ent) "journal"))))
 
 
 
 
 (def built-in-validation-schemas
 (def built-in-validation-schemas

+ 1 - 2
deps/db/src/logseq/db/frontend/schema.cljs

@@ -15,8 +15,7 @@
    ;; "macros" for macro
    ;; "macros" for macro
    ;; "property" for property blocks
    ;; "property" for property blocks
    ;; "class" for structured page
    ;; "class" for structured page
-   :block/type {:db/index true
-                :db/cardinality :db.cardinality/many}
+   :block/type {:db/index true}
    :block/schema {}
    :block/schema {}
    :block/uuid {:db/unique :db.unique/identity}
    :block/uuid {:db/unique :db.unique/identity}
    :block/parent {:db/valueType :db.type/ref
    :block/parent {:db/valueType :db.type/ref

+ 2 - 2
deps/db/src/logseq/db/sqlite/build.cljs

@@ -342,7 +342,7 @@
                       {:db/id (or (:db/id page) (new-db-id))
                       {:db/id (or (:db/id page) (new-db-id))
                        :block/title (or (:block/title page) (string/capitalize (:block/name page)))
                        :block/title (or (:block/title page) (string/capitalize (:block/name page)))
                        :block/name (or (:block/name page) (common-util/page-name-sanity-lc (:block/title page)))
                        :block/name (or (:block/name page) (common-util/page-name-sanity-lc (:block/title page)))
-                       :block/type #{"page"}
+                       :block/type "page"
                        :block/format :markdown}
                        :block/format :markdown}
                       (dissoc page :build/properties :db/id :block/name :block/title :build/tags))
                       (dissoc page :build/properties :db/id :block/name :block/title :build/tags))
             pvalue-tx-m (->property-value-tx-m new-page (:build/properties page) properties all-idents)]
             pvalue-tx-m (->property-value-tx-m new-page (:build/properties page) properties all-idents)]
@@ -465,7 +465,7 @@
                                                    :block/title page-name
                                                    :block/title page-name
                                                    :block/uuid
                                                    :block/uuid
                                                    (common-uuid/gen-uuid :journal-page-uuid date-int)
                                                    (common-uuid/gen-uuid :journal-page-uuid date-int)
-                                                   :block/type #{"journal" "page"}})))))
+                                                   :block/type "journal"})))))
                            m))]
                            m))]
     ;; Order matters as some steps depend on previous step having prepared blocks or pages in a certain way
     ;; Order matters as some steps depend on previous step having prepared blocks or pages in a certain way
     (->> pages-and-blocks
     (->> pages-and-blocks

+ 1 - 1
deps/db/src/logseq/db/sqlite/common_db.cljs

@@ -145,7 +145,7 @@
                              id))
                              id))
         page? (sqlite-util/page? block)
         page? (sqlite-util/page? block)
         get-children (fn [block children page?]
         get-children (fn [block children page?]
-                       (let [long-page? (and (> (count children) 500) (not (contains? (:block/type block) "whiteboard")))]
+                       (let [long-page? (and (> (count children) 500) (not (= (:block/type block) "whiteboard")))]
                          (if long-page?
                          (if long-page?
                            (->> (map (fn [e]
                            (->> (map (fn [e]
                                        (select-keys e [:db/id :block/uuid :block/page :block/order :block/parent :block/collapsed? :block/link]))
                                        (select-keys e [:db/id :block/uuid :block/page :block/order :block/parent :block/collapsed? :block/link]))

+ 2 - 2
deps/db/src/logseq/db/sqlite/create_graph.cljs

@@ -55,14 +55,14 @@
                    ;; Adding built-ins must come after initial properties and built-in-prop-value
                    ;; Adding built-ins must come after initial properties and built-in-prop-value
                    [(mark-block-as-built-in' built-in-property)]
                    [(mark-block-as-built-in' built-in-property)]
                    (map mark-block-as-built-in' properties)
                    (map mark-block-as-built-in' properties)
-                   (keep #(when (= #{"closed value"} (:block/type %)) (mark-block-as-built-in' %))
+                   (keep #(when (= "closed value" (:block/type %)) (mark-block-as-built-in' %))
                          properties))]
                          properties))]
     (doseq [m tx]
     (doseq [m tx]
       (when-let [block-uuid (and (:db/ident m) (:block/uuid m))]
       (when-let [block-uuid (and (:db/ident m) (:block/uuid m))]
         (assert (string/starts-with? (str block-uuid) "00000002") m)))
         (assert (string/starts-with? (str block-uuid) "00000002") m)))
 
 
     {:tx tx
     {:tx tx
-     :properties (filter #(contains? (:block/type %) "property") properties)
+     :properties (filter #(= (:block/type %) "property") properties)
      :built-in-prop-value built-in-prop-value}))
      :built-in-prop-value built-in-prop-value}))
 
 
 (defn kv
 (defn kv

+ 5 - 4
deps/db/src/logseq/db/sqlite/util.cljs

@@ -90,7 +90,7 @@
      (block-with-timestamps
      (block-with-timestamps
       (cond->
       (cond->
        {:db/ident db-ident'
        {:db/ident db-ident'
-        :block/type #{"property" "page"}
+        :block/type "property"
         :block/format :markdown
         :block/format :markdown
         :block/schema (merge {:type :default} (dissoc prop-schema :classes :cardinality))
         :block/schema (merge {:type :default} (dissoc prop-schema :classes :cardinality))
         :block/name (common-util/page-name-sanity-lc (name prop-name))
         :block/name (common-util/page-name-sanity-lc (name prop-name))
@@ -112,7 +112,7 @@
   {:pre [(qualified-keyword? (:db/ident block))]}
   {:pre [(qualified-keyword? (:db/ident block))]}
   (block-with-timestamps
   (block-with-timestamps
    (cond-> (merge block
    (cond-> (merge block
-                  {:block/type (set (concat (:block/type block) ["class" "page"]))
+                  {:block/type "class"
                    :block/format :markdown})
                    :block/format :markdown})
      (not= (:db/ident block) :logseq.class/Root)
      (not= (:db/ident block) :logseq.class/Root)
      (assoc :class/parent :logseq.class/Root))))
      (assoc :class/parent :logseq.class/Root))))
@@ -125,8 +125,9 @@
     :block/title page-name
     :block/title page-name
     :block/uuid (d/squuid)
     :block/uuid (d/squuid)
     :block/format :markdown
     :block/format :markdown
-    :block/type #{"page"}}))
+    :block/type "page"}))
 
 
 (defn page?
 (defn page?
   [block]
   [block]
-  (contains? (:block/type block) "page"))
+  (contains? #{"page" "journal" "whiteboard" "class" "property" "hidden"}
+             (:block/type block)))

+ 2 - 2
deps/db/test/logseq/db/sqlite/build_test.cljs

@@ -14,13 +14,13 @@
            [{:page {:block/title "page1"}
            [{:page {:block/title "page1"}
              :blocks [{:block/title "Jrue Holiday" :build/tags [:Person]}]}
              :blocks [{:block/title "Jrue Holiday" :build/tags [:Person]}]}
             {:page {:block/title "Jayson Tatum" :build/tags [:Person]}}])]
             {:page {:block/title "Jayson Tatum" :build/tags [:Person]}}])]
-    (is (= {:block/tags [{:block/title "Person", :block/type ["class" "page"]}]}
+    (is (= {:block/tags [{:block/title "Person", :block/type "class"}]}
            (first (d/q '[:find [(pull ?b [{:block/tags [:block/title :block/type]}]) ...]
            (first (d/q '[:find [(pull ?b [{:block/tags [:block/title :block/type]}]) ...]
                          :where [?b :block/title "Jrue Holiday"]]
                          :where [?b :block/title "Jrue Holiday"]]
                        @conn)))
                        @conn)))
         "Person class is created and correctly associated to a block")
         "Person class is created and correctly associated to a block")
 
 
-    (is (= {:block/tags [{:block/title "Person", :block/type ["class" "page"]}]}
+    (is (= {:block/tags [{:block/title "Person", :block/type "class"}]}
            (first (d/q '[:find [(pull ?b [{:block/tags [:block/title :block/type]}]) ...]
            (first (d/q '[:find [(pull ?b [{:block/tags [:block/title :block/type]}]) ...]
                          :where [?b :block/title "Jayson Tatum"]]
                          :where [?b :block/title "Jayson Tatum"]]
                        @conn)))
                        @conn)))

+ 3 - 3
deps/db/test/logseq/db/sqlite/create_graph_test.cljs

@@ -37,7 +37,7 @@
                                            (map #(keyword (namespace %) (string/replace (name %) #".[^.]+$" "")))
                                            (map #(keyword (namespace %) (string/replace (name %) #".[^.]+$" "")))
                                            set)]
                                            set)]
           (is (= []
           (is (= []
-                 (remove #(= ["closed value"] (:block/type %)) closed-value-ents))
+                 (remove #(= "closed value" (:block/type %)) closed-value-ents))
               "All property names that contain a '.' are closed values")
               "All property names that contain a '.' are closed values")
           (is (= #{}
           (is (= #{}
                  (set/difference closed-value-properties (set default-idents)))
                  (set/difference closed-value-properties (set default-idents)))
@@ -62,11 +62,11 @@
   (let [conn (d/create-conn db-schema/schema-for-db-based-graph)
   (let [conn (d/create-conn db-schema/schema-for-db-based-graph)
         _ (d/transact! conn (sqlite-create-graph/build-db-initial-data "{}"))
         _ (d/transact! conn (sqlite-create-graph/build-db-initial-data "{}"))
         task (d/entity @conn :logseq.class/Task)]
         task (d/entity @conn :logseq.class/Task)]
-    (is (contains? (:block/type task) "class")
+    (is (= (:block/type task) "class")
         "Task class has correct type")
         "Task class has correct type")
     (is (= 3 (count (:class/schema.properties task)))
     (is (= 3 (count (:class/schema.properties task)))
         "Has correct number of task properties")
         "Has correct number of task properties")
-    (is (every? #(contains? (:block/type %) "property")
+    (is (every? #(= (:block/type %) "property")
                 (:class/schema.properties task))
                 (:class/schema.properties task))
         "Each task property has correct type")))
         "Each task property has correct type")))
 
 

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

@@ -345,7 +345,7 @@
                         {:block/created-at current-ms
                         {:block/created-at current-ms
                          :block/updated-at current-ms}))
                          :block/updated-at current-ms}))
                     (if journal-day
                     (if journal-day
-                      {:block/type #{"journal"}
+                      {:block/type "journal"
                        :block/journal-day journal-day}
                        :block/journal-day journal-day}
                       {})))
                       {})))
 
 
@@ -358,12 +358,8 @@
                  :else
                  :else
                  nil)]
                  nil)]
       (when page
       (when page
-        (let [type (:block/type page)
-              type' (if (string? type) [type] type)
-              type' (cons "page" type')
-              type' (if class? (cons "class" type') type')
-              types (set type')]
-          (assoc page :block/type types))))))
+        (let [type (if class? "class" (or (:block/type page) "page"))]
+          (assoc page :block/type type))))))
 
 
 (defn- with-page-refs-and-tags
 (defn- with-page-refs-and-tags
   [{:keys [title body tags refs marker priority] :as block} db date-formatter]
   [{:keys [title body tags refs marker priority] :as block} db date-formatter]

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

@@ -202,7 +202,7 @@
                                           (date-time-util/int->journal-title date-int (common-config/get-date-formatter user-config)))]
                                           (date-time-util/int->journal-title date-int (common-config/get-date-formatter user-config)))]
                               (assoc page-m
                               (assoc page-m
                                      :block/uuid (common-uuid/gen-uuid :journal-page-uuid date-int)
                                      :block/uuid (common-uuid/gen-uuid :journal-page-uuid date-int)
-                                     :block/type (conj (:block/type page-m) "journal")
+                                     :block/type "journal"
                                      :block/journal-day date-int)))]
                                      :block/journal-day date-int)))]
       {:block
       {:block
        (-> block
        (-> block
@@ -263,7 +263,7 @@
   (let [prop-type (cond (and (coll? prop-val)
   (let [prop-type (cond (and (coll? prop-val)
                              (seq prop-val)
                              (seq prop-val)
                              (set/subset? prop-val
                              (set/subset? prop-val
-                                          (set (keep #(when (contains? (:block/type %) "journal")
+                                          (set (keep #(when (= (:block/type %) "journal")
                                                         (:block/title %)) refs))))
                                                         (:block/title %)) refs))))
                         :date
                         :date
                         (and (coll? prop-val) (seq prop-val) (text-with-refs? prop-val prop-val-text))
                         (and (coll? prop-val) (seq prop-val) (text-with-refs? prop-val prop-val-text))
@@ -890,8 +890,7 @@
         {:keys [pages-tx page-properties-tx page-names-to-uuids existing-pages]} (build-pages-tx conn pages blocks tx-options)
         {:keys [pages-tx page-properties-tx page-names-to-uuids existing-pages]} (build-pages-tx conn pages blocks tx-options)
         whiteboard-pages (->> pages-tx
         whiteboard-pages (->> pages-tx
                               ;; support old and new whiteboards
                               ;; support old and new whiteboards
-                              (filter #(or (contains? (set (:block/type %)) "whiteboard")
-                                           (= "whiteboard" (:block/type %))))
+                              (filter #(= (:block/type %) "whiteboard"))
                               (map (fn [page-block]
                               (map (fn [page-block]
                                      (-> page-block
                                      (-> page-block
                                          (assoc :block/format :markdown
                                          (assoc :block/format :markdown

+ 3 - 3
deps/graph-parser/src/logseq/graph_parser/extract.cljc

@@ -220,7 +220,7 @@
                       (vec))
                       (vec))
           ref-pages (atom #{})
           ref-pages (atom #{})
           blocks (map (fn [block]
           blocks (map (fn [block]
-                        (if (contains? (:block/type block) "macro")
+                        (if (= (:block/type block) "macro")
                           block
                           block
                           (let [block-ref-pages (seq (:block/refs block))]
                           (let [block-ref-pages (seq (:block/refs block))]
                             (when block-ref-pages
                             (when block-ref-pages
@@ -320,13 +320,13 @@
                           (filepath->page-name file))
                           (filepath->page-name file))
                       (common-util/page-name-sanity-lc))
                       (common-util/page-name-sanity-lc))
         title (or (:block/title serialized-page)
         title (or (:block/title serialized-page)
-                          page-name)
+                  page-name)
         page-block (merge {:block/name page-name
         page-block (merge {:block/name page-name
                            :block/title title
                            :block/title title
                            :block/file {:file/path (common-util/path-normalize file)}}
                            :block/file {:file/path (common-util/path-normalize file)}}
                           serialized-page
                           serialized-page
                           ;; Ensure old whiteboards have correct type
                           ;; Ensure old whiteboards have correct type
-                          {:block/type #{"whiteboard" "page"}})
+                          {:block/type "whiteboard"})
         page-block (gp-whiteboard/migrate-page-block page-block)
         page-block (gp-whiteboard/migrate-page-block page-block)
         blocks (->> blocks
         blocks (->> blocks
                     (map gp-whiteboard/migrate-shape-block)
                     (map gp-whiteboard/migrate-shape-block)

+ 5 - 5
deps/graph-parser/test/logseq/graph_parser/exporter_test.cljs

@@ -171,7 +171,7 @@
       (is (= 6
       (is (= 6
              (count (->> (d/q '[:find [(pull ?b [:block/title :block/type]) ...]
              (count (->> (d/q '[:find [(pull ?b [:block/title :block/type]) ...]
                                 :where [?b :block/title] [_ :block/page ?b]] @conn)
                                 :where [?b :block/title] [_ :block/page ?b]] @conn)
-                         (filter #(= ["page"] (:block/type %))))))
+                         (filter #(= "page" (:block/type %))))))
           "Correct number of pages with block content")
           "Correct number of pages with block content")
       (is (= 4 (count (d/datoms @conn :avet :block/type "whiteboard"))))
       (is (= 4 (count (d/datoms @conn :avet :block/type "whiteboard"))))
       (is (= 1 (count @(:ignored-properties import-state))) ":filters should be the only ignored property")
       (is (= 1 (count @(:ignored-properties import-state))) ":filters should be the only ignored property")
@@ -375,7 +375,7 @@
             "tagged block tag converts tag to page ref")
             "tagged block tag converts tag to page ref")
         (is (= [(:db/id tag-page)] (map :db/id (:block/refs block)))
         (is (= [(:db/id tag-page)] (map :db/id (:block/refs block)))
             "tagged block has correct refs")
             "tagged block has correct refs")
-        (is (and tag-page (not (contains? (set (:block/type tag-page)) "class")))
+        (is (and tag-page (not (= (:block/type tag-page) "class")))
             "tag page is not a class")
             "tag page is not a class")
 
 
         (is (= {:logseq.property/page-tags #{"Movie"}}
         (is (= {:logseq.property/page-tags #{"Movie"}}
@@ -404,9 +404,9 @@
              (:block/tags (readable-properties @conn block)))
              (:block/tags (readable-properties @conn block)))
           "tagged block has configured tag imported as a class")
           "tagged block has configured tag imported as a class")
 
 
-      (is (= ["class" "page"] (:block/type tag-page))
+      (is (= "class" (:block/type tag-page))
           "configured tag page in :tag-classes is a class")
           "configured tag page in :tag-classes is a class")
-      (is (and another-tag-page (not (contains? (set (:block/type another-tag-page)) "class")))
+      (is (and another-tag-page (not= (:block/type another-tag-page) "class"))
           "unconfigured tag page is not a class")
           "unconfigured tag page is not a class")
 
 
       (is (= {:block/tags [:user.class/Movie]}
       (is (= {:block/tags [:user.class/Movie]}
@@ -465,7 +465,7 @@
           "tagged block can have another property that references the same class it is tagged with,
           "tagged block can have another property that references the same class it is tagged with,
            without creating a duplicate class")
            without creating a duplicate class")
 
 
-      (is (= ["class" "page"] (:block/type tag-page))
+      (is (= "class" (:block/type tag-page))
           "configured tag page derived from :property-classes is a class")
           "configured tag page derived from :property-classes is a class")
       (is (nil? (find-page-by-name @conn "type"))
       (is (nil? (find-page-by-name @conn "type"))
           "No page exists for configured property")
           "No page exists for configured property")

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

@@ -144,6 +144,6 @@
         page (first pages)]
         page (first pages)]
     (is (= (get-in page [:block/file :file/path]) "/whiteboards/foo.edn"))
     (is (= (get-in page [:block/file :file/path]) "/whiteboards/foo.edn"))
     (is (= (:block/name page) "foo"))
     (is (= (:block/name page) "foo"))
-    (is (= (:block/type page) #{"whiteboard" "page"}))
+    (is (= (:block/type page) "whiteboard"))
     (is (= (:block/title page) "Foo"))
     (is (= (:block/title page) "Foo"))
     (is (every? #(= (:block/parent %) [:block/uuid #uuid "a846e3b4-c41d-4251-80e1-be6978c36d8c"]) blocks))))
     (is (every? #(= (:block/parent %) [:block/uuid #uuid "a846e3b4-c41d-4251-80e1-be6978c36d8c"]) blocks))))

+ 1 - 1
deps/graph-parser/test/logseq/graph_parser_test.cljs

@@ -99,7 +99,7 @@
             parent (:block/page (ffirst blocks))]
             parent (:block/page (ffirst blocks))]
         (is (= {:block/name "foo"
         (is (= {:block/name "foo"
                 :block/title "Foo"
                 :block/title "Foo"
-                :block/type ["page" "whiteboard"]
+                :block/type "whiteboard"
                 :block/file {:file/path "/whiteboards/foo.edn"}}
                 :block/file {:file/path "/whiteboards/foo.edn"}}
                parent)
                parent)
             "parsed block in the whiteboard page has correct parent page"))))
             "parsed block in the whiteboard page has correct parent page"))))

文件差异内容过多而无法显示
+ 0 - 0
deps/graph-parser/test/resources/exporter-test-graph/whiteboards/Test Whiteboard.edn


+ 125 - 127
deps/graph-parser/test/resources/exporter-test-graph/whiteboards/block tests.edn

@@ -1,127 +1,125 @@
-{:blocks (
-{:block/title "block with page ref [[some page]]"
-:block/created-at 1720805247589
-:block/format :markdown
-:block/parent
-{:block/uuid #uuid "6691676f-2eed-4619-b56a-69fd7d572c59"}
-:block/properties
-{}
-:block/updated-at 1720809014394
-:block/uuid #uuid "6691677f-c208-4c83-aa40-6efc4286100c"} 
-{:block/created-at 1721935480784
-:block/properties 
-{:ls-type :whiteboard-shape
-:logseq.tldraw.shape
-{:blockType "B"
-:stroke ""
-:collapsed false
-:borderRadius 8
-:scale [1 1]
-:pageId "6691677f-c208-4c83-aa40-6efc4286100c"
-:scaleLevel "md"
-:fill ""
-:compact true
-:isAutoResizing true
-:type "logseq-portal"
-:size [400 124.9781494140625]
-:strokeType "line"
-:strokeWidth 2
-:opacity 1
-:id "01b33340-4074-11ef-956e-7d9aebf284ae"
-:noFill false
-:point [430.41563108563423 233.00156784057617]
-:parentId "6691676f-2eed-4619-b56a-69fd7d572c59"
-:collapsedHeight 0
-:nonce 1720805246071
-:pageName nil}}
-:block/updated-at 1721935480784} 
-{:block/title "block with block ref ((669168ed-8734-4943-8a86-5e3a553a526d))"
-:block/created-at 1720808993012
-:block/format :markdown
-:block/parent
-{:block/uuid #uuid "6691676f-2eed-4619-b56a-69fd7d572c59"}
-:block/properties
-{}
-:block/updated-at 1720809157098
-:block/uuid #uuid "66917621-93ae-475b-aa4c-6ae9e797cf68"}
-{:block/properties
-{:ls-type :whiteboard-shape
-:logseq.tldraw.shape
-{:blockType "B"
-:stroke ""
-:collapsed false
-:borderRadius 8
-:scale [1 1]
-:pageId "66917621-93ae-475b-aa4c-6ae9e797cf68"
-:scaleLevel "md"
-:fill ""
-:compact true
-:isAutoResizing true
-:type "logseq-portal"
-:size [400 79.9781265258789]
-:strokeType "line"
-:strokeWidth 2
-:opacity 1
-:id "b999ee10-407c-11ef-956e-7d9aebf284ae"
-:noFill false
-:point [478.6382088826831 337.7821947259741]
-:parentId "6691676f-2eed-4619-b56a-69fd7d572c59"
-:collapsedHeight 0
-:nonce 1720808990579
-:pageName nil}}
-:block/updated-at 1720809157310
-:block/created-at 1720809157310} 
-{:block/title "block with props\nprop-num:: 10"
-:block/created-at 1721935480737
-:block/format :markdown
-:block/parent 
-{:block/uuid #uuid "6691676f-2eed-4619-b56a-69fd7d572c59"}
-:block/properties 
-{:prop-num 10}
-:block/updated-at 1721935504617
-:block/uuid #uuid "66a2a678-1cea-44b6-a458-4b8c15e18a8d"} 
-{:block/properties 
-{:ls-type :whiteboard-shape
-:logseq.tldraw.shape 
-{:blockType "B"
-:stroke ""
-:collapsed false
-:borderRadius 8
-:scale [1 1]
-:pageId "66a2a678-1cea-44b6-a458-4b8c15e18a8d"
-:scaleLevel "md"
-:fill ""
-:compact true
-:isAutoResizing true
-:type "logseq-portal"
-:size [400 320]
-:strokeType "line"
-:strokeWidth 2
-:opacity 1
-:id "86f86420-4abb-11ef-9161-b98dd17dbef1"
-:noFill false
-:point [648.5671437694965 179.003191006195]
-:parentId "6691676f-2eed-4619-b56a-69fd7d572c59"
-:collapsedHeight 0
-:nonce 1721935475555
-:pageName nil}}
-:block/updated-at 1721935504609
-:block/created-at 1721935504609})
-:pages (
-{:block/tx-id 536871657
-:block/uuid #uuid "6691676f-2eed-4619-b56a-69fd7d572c59"
-:block/properties
-{:ls-type :whiteboard-page
-:logseq.tldraw.page
-{:id "6691676f-2eed-4619-b56a-69fd7d572c59"
-:name "ref page"
-:bindings
-{}
-:nonce 1
-:assets []}}
-:block/updated-at 1721935504609
-:block/created-at 1720805231835
-:block/format :markdown
-:block/type ["page" "whiteboard"]
-:block/name "ref page"
-:block/title "ref page"})}
+{:blocks ({:block/title "block with page ref [[some page]]"
+           :block/created-at 1720805247589
+           :block/format :markdown
+           :block/parent
+           {:block/uuid #uuid "6691676f-2eed-4619-b56a-69fd7d572c59"}
+           :block/properties
+           {}
+           :block/updated-at 1720809014394
+           :block/uuid #uuid "6691677f-c208-4c83-aa40-6efc4286100c"}
+          {:block/created-at 1721935480784
+           :block/properties
+           {:ls-type :whiteboard-shape
+            :logseq.tldraw.shape
+            {:blockType "B"
+             :stroke ""
+             :collapsed false
+             :borderRadius 8
+             :scale [1 1]
+             :pageId "6691677f-c208-4c83-aa40-6efc4286100c"
+             :scaleLevel "md"
+             :fill ""
+             :compact true
+             :isAutoResizing true
+             :type "logseq-portal"
+             :size [400 124.9781494140625]
+             :strokeType "line"
+             :strokeWidth 2
+             :opacity 1
+             :id "01b33340-4074-11ef-956e-7d9aebf284ae"
+             :noFill false
+             :point [430.41563108563423 233.00156784057617]
+             :parentId "6691676f-2eed-4619-b56a-69fd7d572c59"
+             :collapsedHeight 0
+             :nonce 1720805246071
+             :pageName nil}}
+           :block/updated-at 1721935480784}
+          {:block/title "block with block ref ((669168ed-8734-4943-8a86-5e3a553a526d))"
+           :block/created-at 1720808993012
+           :block/format :markdown
+           :block/parent
+           {:block/uuid #uuid "6691676f-2eed-4619-b56a-69fd7d572c59"}
+           :block/properties
+           {}
+           :block/updated-at 1720809157098
+           :block/uuid #uuid "66917621-93ae-475b-aa4c-6ae9e797cf68"}
+          {:block/properties
+           {:ls-type :whiteboard-shape
+            :logseq.tldraw.shape
+            {:blockType "B"
+             :stroke ""
+             :collapsed false
+             :borderRadius 8
+             :scale [1 1]
+             :pageId "66917621-93ae-475b-aa4c-6ae9e797cf68"
+             :scaleLevel "md"
+             :fill ""
+             :compact true
+             :isAutoResizing true
+             :type "logseq-portal"
+             :size [400 79.9781265258789]
+             :strokeType "line"
+             :strokeWidth 2
+             :opacity 1
+             :id "b999ee10-407c-11ef-956e-7d9aebf284ae"
+             :noFill false
+             :point [478.6382088826831 337.7821947259741]
+             :parentId "6691676f-2eed-4619-b56a-69fd7d572c59"
+             :collapsedHeight 0
+             :nonce 1720808990579
+             :pageName nil}}
+           :block/updated-at 1720809157310
+           :block/created-at 1720809157310}
+          {:block/title "block with props\nprop-num:: 10"
+           :block/created-at 1721935480737
+           :block/format :markdown
+           :block/parent
+           {:block/uuid #uuid "6691676f-2eed-4619-b56a-69fd7d572c59"}
+           :block/properties
+           {:prop-num 10}
+           :block/updated-at 1721935504617
+           :block/uuid #uuid "66a2a678-1cea-44b6-a458-4b8c15e18a8d"}
+          {:block/properties
+           {:ls-type :whiteboard-shape
+            :logseq.tldraw.shape
+            {:blockType "B"
+             :stroke ""
+             :collapsed false
+             :borderRadius 8
+             :scale [1 1]
+             :pageId "66a2a678-1cea-44b6-a458-4b8c15e18a8d"
+             :scaleLevel "md"
+             :fill ""
+             :compact true
+             :isAutoResizing true
+             :type "logseq-portal"
+             :size [400 320]
+             :strokeType "line"
+             :strokeWidth 2
+             :opacity 1
+             :id "86f86420-4abb-11ef-9161-b98dd17dbef1"
+             :noFill false
+             :point [648.5671437694965 179.003191006195]
+             :parentId "6691676f-2eed-4619-b56a-69fd7d572c59"
+             :collapsedHeight 0
+             :nonce 1721935475555
+             :pageName nil}}
+           :block/updated-at 1721935504609
+           :block/created-at 1721935504609})
+ :pages ({:block/tx-id 536871657
+          :block/uuid #uuid "6691676f-2eed-4619-b56a-69fd7d572c59"
+          :block/properties
+          {:ls-type :whiteboard-page
+           :logseq.tldraw.page
+           {:id "6691676f-2eed-4619-b56a-69fd7d572c59"
+            :name "ref page"
+            :bindings
+            {}
+            :nonce 1
+            :assets []}}
+          :block/updated-at 1721935504609
+          :block/created-at 1720805231835
+          :block/format :markdown
+          :block/type "whiteboard"
+          :block/name "ref page"
+          :block/title "ref page"})}

+ 1 - 1
deps/graph-parser/test/resources/exporter-test-graph/whiteboards/publishing test.edn

@@ -438,6 +438,6 @@
             :shapes-index ("665eeab0-ccca-11ed-8c36-cd64b4f8676b" "689db722-ccca-11ed-8c36-cd64b4f8676b" "08b11d80-cda0-11ed-8356-d36ee09ec21e" "a5ced1d0-d3cb-11ed-84d2-d9f3e7dd8e6d" "c80e4880-dad2-11ed-b0d8-ef9040ba205f" "cae02d30-dad2-11ed-b0d8-ef9040ba205f" "ce9d5c40-dad2-11ed-b0d8-ef9040ba205f" "d0eb6af0-dad2-11ed-b0d8-ef9040ba205f" "d51c4360-dad2-11ed-b0d8-ef9040ba205f" "17a61b70-dad3-11ed-b0d8-ef9040ba205f" "1ee6f300-dad3-11ed-b0d8-ef9040ba205f" "46999ba0-dad3-11ed-b0d8-ef9040ba205f" "4ac3e461-dad3-11ed-b0d8-ef9040ba205f" "3f1d1b80-cdaa-11ed-8356-d36ee09ec21e" "eb97f800-dfa0-11ed-8d23-dd2d2525f6dc")}}
             :shapes-index ("665eeab0-ccca-11ed-8c36-cd64b4f8676b" "689db722-ccca-11ed-8c36-cd64b4f8676b" "08b11d80-cda0-11ed-8356-d36ee09ec21e" "a5ced1d0-d3cb-11ed-84d2-d9f3e7dd8e6d" "c80e4880-dad2-11ed-b0d8-ef9040ba205f" "cae02d30-dad2-11ed-b0d8-ef9040ba205f" "ce9d5c40-dad2-11ed-b0d8-ef9040ba205f" "d0eb6af0-dad2-11ed-b0d8-ef9040ba205f" "d51c4360-dad2-11ed-b0d8-ef9040ba205f" "17a61b70-dad3-11ed-b0d8-ef9040ba205f" "1ee6f300-dad3-11ed-b0d8-ef9040ba205f" "46999ba0-dad3-11ed-b0d8-ef9040ba205f" "4ac3e461-dad3-11ed-b0d8-ef9040ba205f" "3f1d1b80-cdaa-11ed-8356-d36ee09ec21e" "eb97f800-dfa0-11ed-8d23-dd2d2525f6dc")}}
           :block/updated-at 1707842737378
           :block/updated-at 1707842737378
           :block/created-at 1679940473374
           :block/created-at 1679940473374
-          :block/type ["whiteboard"]
+          :block/type "whiteboard"
           :block/name "publishing test"
           :block/name "publishing test"
           :block/title "publishing test"})}
           :block/title "publishing test"})}

+ 4 - 4
deps/outliner/src/logseq/outliner/property.cljs

@@ -333,7 +333,7 @@
 
 
 (defn ^:api get-class-parents
 (defn ^:api get-class-parents
   [tags]
   [tags]
-  (let [tags' (filter (fn [tag] (contains? (:block/type tag) "class")) tags)]
+  (let [tags' (filter (fn [tag] (= (:block/type tag) "class")) tags)]
     (set (mapcat ldb/get-class-parents tags'))))
     (set (mapcat ldb/get-class-parents tags'))))
 
 
 (defn ^:api get-class-properties
 (defn ^:api get-class-properties
@@ -349,7 +349,7 @@
   (let [block (d/entity db eid)
   (let [block (d/entity db eid)
         classes (->> (:block/tags block)
         classes (->> (:block/tags block)
                      (sort-by :block/name)
                      (sort-by :block/name)
-                     (filter (fn [tag] (contains? (:block/type tag) "class"))))
+                     (filter (fn [tag] (= (:block/type tag) "class"))))
         class-parents (get-class-parents classes)
         class-parents (get-class-parents classes)
         all-classes (->> (concat classes class-parents)
         all-classes (->> (concat classes class-parents)
                          (filter (fn [class]
                          (filter (fn [class]
@@ -517,7 +517,7 @@
 (defn class-add-property!
 (defn class-add-property!
   [conn class-id property-id]
   [conn class-id property-id]
   (when-let [class (d/entity @conn class-id)]
   (when-let [class (d/entity @conn class-id)]
-    (if (contains? (:block/type class) "class")
+    (if (= (:block/type class) "class")
       (ldb/transact! conn
       (ldb/transact! conn
                      [[:db/add (:db/id class) :class/schema.properties property-id]]
                      [[:db/add (:db/id class) :class/schema.properties property-id]]
                      {:outliner-op :save-block})
                      {:outliner-op :save-block})
@@ -527,7 +527,7 @@
 (defn class-remove-property!
 (defn class-remove-property!
   [conn class-id property-id]
   [conn class-id property-id]
   (when-let [class (d/entity @conn class-id)]
   (when-let [class (d/entity @conn class-id)]
-    (when (contains? (:block/type class) "class")
+    (when (= (:block/type class) "class")
       (when-let [property (d/entity @conn property-id)]
       (when-let [property (d/entity @conn property-id)]
         (when-not (ldb/built-in-class-property? class property)
         (when-not (ldb/built-in-class-property? class property)
           (ldb/transact! conn [[:db/retract (:db/id class) :class/schema.properties property-id]]
           (ldb/transact! conn [[:db/retract (:db/id class) :class/schema.properties property-id]]

+ 1 - 1
src/main/frontend/common_keywords.cljs

@@ -13,7 +13,7 @@
 
 
 (sr/defkeyword :block/type
 (sr/defkeyword :block/type
   "block type"
   "block type"
-  [:set [:enum "page" "property" "class" "whiteboard" "hidden"]])
+  [:enum "page" "property" "class" "whiteboard" "hidden"])
 
 
 (sr/defkeyword :block/parent
 (sr/defkeyword :block/parent
   "page blocks don't have this attr")
   "page blocks don't have this attr")

+ 2 - 2
src/main/frontend/components/all_pages.cljs

@@ -23,8 +23,8 @@
            :type :string}
            :type :string}
           {:id :block/type
           {:id :block/type
            :name "Type"
            :name "Type"
-           :cell (fn [_table row _column] [:div.capitalize (string/join ", " (get row :block/type))])
-           :get-value (fn [row] (string/join ", " (get row :block/type)))
+           :cell (fn [_table row _column] [:div.capitalize (get row :block/type)])
+           :get-value (fn [row] (get row :block/type))
            :type :string}
            :type :string}
           (when db-based?
           (when db-based?
             {:id :block/tags
             {:id :block/tags

+ 11 - 11
src/main/frontend/components/db_based/page.cljs

@@ -52,9 +52,9 @@
   [state page *mode]
   [state page *mode]
   (let [*mode *mode
   (let [*mode *mode
         mode (rum/react *mode)
         mode (rum/react *mode)
-        types (:block/type page)
-        class? (contains? types "class")
-        property? (contains? types "property")
+        type (:block/type page)
+        class? (= type "class")
+        property? (= type "property")
         page-opts {:configure? true}]
         page-opts {:configure? true}]
     (when (nil? mode)
     (when (nil? mode)
       (reset! *mode (cond
       (reset! *mode (cond
@@ -74,10 +74,10 @@
        (page-properties page (assoc page-opts :mode mode)))]))
        (page-properties page (assoc page-opts :mode mode)))]))
 
 
 (rum/defc mode-switch < rum/reactive
 (rum/defc mode-switch < rum/reactive
-  [types *mode]
+  [type *mode]
   (let [current-mode (rum/react *mode)
   (let [current-mode (rum/react *mode)
-        class? (contains? types "class")
-        property? (contains? types "property")
+        class? (= type "class")
+        property? (= type "property")
         modes (->
         modes (->
                (cond
                (cond
                  property?
                  property?
@@ -106,8 +106,8 @@
   (let [page (db/sub-block (:db/id page))
   (let [page (db/sub-block (:db/id page))
         *hover? (::hover? state)
         *hover? (::hover? state)
         *mode (::mode state)
         *mode (::mode state)
-        types (:block/type page)
-        class? (contains? types "class")
+        type (:block/type page)
+        class? (= type "class")
         collapsed? (not @*show-info?)
         collapsed? (not @*show-info?)
         has-properties? (or
         has-properties? (or
                          (seq (:block/tags page))
                          (seq (:block/tags page))
@@ -118,7 +118,7 @@
     (when (if config/publishing?
     (when (if config/publishing?
             ;; Since publishing is read-only, hide this component if it has no info to show
             ;; Since publishing is read-only, hide this component if it has no info to show
             ;; as it creates a fair amount of empty vertical space
             ;; as it creates a fair amount of empty vertical space
-            (some? types)
+            (some? type)
             show-info?)
             show-info?)
       [:div.page-info
       [:div.page-info
        {:class (util/classnames [{:is-collapsed collapsed?}])}
        {:class (util/classnames [{:is-collapsed collapsed?}])}
@@ -132,14 +132,14 @@
                                (reset! *hover? false))
                                (reset! *hover? false))
             :on-click (if config/publishing?
             :on-click (if config/publishing?
                         (fn [_]
                         (fn [_]
-                          (when (seq (set/intersection #{"class" "property"} types))
+                          (when (contains? #{"class" "property"} type)
                             (swap! *show-info? not)))
                             (swap! *show-info? not)))
                         #(do
                         #(do
                            (swap! *show-info? not)
                            (swap! *show-info? not)
                            (swap! *hover? not)))}
                            (swap! *hover? not)))}
            [:<>
            [:<>
             [:div.flex.flex-row.items-center.gap-1
             [:div.flex.flex-row.items-center.gap-1
-             (mode-switch types *mode)]
+             (mode-switch type *mode)]
             [:div.absolute.right-1.top-1
             [:div.absolute.right-1.top-1
              (shui/button
              (shui/button
               {:variant :ghost :size :sm
               {:variant :ghost :size :sm

+ 2 - 2
src/main/frontend/components/imports.cljs

@@ -238,9 +238,9 @@
   {:entities (count entities)
   {:entities (count entities)
    :pages (count (filter :block/name entities))
    :pages (count (filter :block/name entities))
    :blocks (count (filter :block/title entities))
    :blocks (count (filter :block/title entities))
-   :classes (count (filter #(contains? (:block/type %) "class") entities))
+   :classes (count (filter #(= (:block/type %) "class") entities))
    :objects (count (filter #(seq (:block/tags %)) entities))
    :objects (count (filter #(seq (:block/tags %)) entities))
-   :properties (count (filter #(contains? (:block/type %) "property") entities))
+   :properties (count (filter #(= (:block/type %) "property") entities))
    :property-values (count (mapcat :block/properties entities))})
    :property-values (count (mapcat :block/properties entities))})
 
 
 (defn- validate-imported-data
 (defn- validate-imported-data

+ 1 - 1
src/main/frontend/components/page.cljs

@@ -586,7 +586,7 @@
             (when (and (not block?) (not db-based?))
             (when (and (not block?) (not db-based?))
               (tagged-pages repo page page-title))
               (tagged-pages repo page page-title))
 
 
-            (when (contains? (:block/type page) "class")
+            (when (= (:block/type page) "class")
               (class-component/class-children page))
               (class-component/class-children page))
 
 
             ;; referenced blocks
             ;; referenced blocks

+ 1 - 1
src/main/frontend/components/page_menu.cljs

@@ -50,7 +50,7 @@
   (when-let [page-name (and page (db/page? page) (:block/name page))]
   (when-let [page-name (and page (db/page? page) (:block/name page))]
     (let [repo (state/sub :git/current-repo)
     (let [repo (state/sub :git/current-repo)
           page-title (:block/title page)
           page-title (:block/title page)
-          whiteboard? (contains? (set (:block/type page)) "whiteboard")
+          whiteboard? (= (:block/type page) "whiteboard")
           block? (and page (util/uuid-string? page-name) (not whiteboard?))
           block? (and page (util/uuid-string? page-name) (not whiteboard?))
           contents? (= page-name "contents")
           contents? (= page-name "contents")
           public? (pu/get-block-property-value page :logseq.property/public)
           public? (pu/get-block-property-value page :logseq.property/public)

+ 4 - 4
src/main/frontend/components/property.cljs

@@ -112,7 +112,7 @@
 
 
 (defn- handle-delete-property!
 (defn- handle-delete-property!
   [block property & {:keys [class? class-schema?]}]
   [block property & {:keys [class? class-schema?]}]
-  (let [class? (or class? (some-> block :block/type (contains? "class")))
+  (let [class? (or class? (= (:block/type block) "class"))
         remove! #(let [repo (state/get-current-repo)]
         remove! #(let [repo (state/get-current-repo)]
                    (if (and class? class-schema?)
                    (if (and class? class-schema?)
                      (db-property-handler/class-remove-property! (:db/id block) (:db/id property))
                      (db-property-handler/class-remove-property! (:db/id block) (:db/id property))
@@ -130,7 +130,7 @@
   [entity property-uuid-or-name schema {:keys [class-schema? page-configure?]}]
   [entity property-uuid-or-name schema {:keys [class-schema? page-configure?]}]
   (p/let [repo (state/get-current-repo)
   (p/let [repo (state/get-current-repo)
           ;; Both conditions necessary so that a class can add its own page properties
           ;; Both conditions necessary so that a class can add its own page properties
-          add-class-property? (and (contains? (:block/type entity) "class") page-configure? class-schema?)
+          add-class-property? (and (= (:block/type entity) "class") page-configure? class-schema?)
           result (when (uuid? property-uuid-or-name)
           result (when (uuid? property-uuid-or-name)
                    (db-async/<get-block repo property-uuid-or-name {:children? false}))
                    (db-async/<get-block repo property-uuid-or-name {:children? false}))
           ;; In block context result is in :block
           ;; In block context result is in :block
@@ -192,7 +192,7 @@
                 (reset! *show-new-property-config? :adding-property))
                 (reset! *show-new-property-config? :adding-property))
               (p/let [property' (when block (<add-property-from-dropdown block property-name schema opts))
               (p/let [property' (when block (<add-property-from-dropdown block property-name schema opts))
                       property (or property' property)
                       property (or property' property)
-                      add-class-property? (and (contains? (:block/type block) "class") page-configure? class-schema?)]
+                      add-class-property? (and (= (:block/type block) "class") page-configure? class-schema?)]
                 (when *property (reset! *property property))
                 (when *property (reset! *property property))
                 (p/do!
                 (p/do!
                  (when *show-new-property-config? (reset! *show-new-property-config? false))
                  (when *show-new-property-config? (reset! *show-new-property-config? false))
@@ -459,7 +459,7 @@
         (reset! *show-new-property-config? true))
         (reset! *show-new-property-config? true))
       (reset! *property property)
       (reset! *property property)
       (when property
       (when property
-        (let [add-class-property? (and (contains? (:block/type block) "class") class-schema?)
+        (let [add-class-property? (and (= (:block/type block) "class") class-schema?)
               type (get-in property [:block/schema :type])]
               type (get-in property [:block/schema :type])]
           (cond
           (cond
             add-class-property?
             add-class-property?

+ 2 - 2
src/main/frontend/components/property/value.cljs

@@ -99,7 +99,7 @@
   ([block property-id property-value' {:keys [exit-edit? class-schema?]
   ([block property-id property-value' {:keys [exit-edit? class-schema?]
                                        :or {exit-edit? true}}]
                                        :or {exit-edit? true}}]
    (let [repo (state/get-current-repo)
    (let [repo (state/get-current-repo)
-         class? (contains? (:block/type block) "class")
+         class? (= (:block/type block) "class")
          property (db/entity property-id)
          property (db/entity property-id)
          many? (db-property/many? property)
          many? (db-property/many? property)
          checkbox? (= :checkbox (get-in property [:block/schema :type]))]
          checkbox? (= :checkbox (get-in property [:block/schema :type]))]
@@ -563,7 +563,7 @@
     (if (state/sub-async-query-loading value)
     (if (state/sub-async-query-loading value)
       [:div.text-sm.opacity-70 "loading"]
       [:div.text-sm.opacity-70 "loading"]
       (if-let [v-block (db/sub-block (:db/id value))]
       (if-let [v-block (db/sub-block (:db/id value))]
-        (let [class? (contains? (:block/type v-block) "class")
+        (let [class? (= (:block/type v-block) "class")
               invalid-warning [:div.warning.text-sm
               invalid-warning [:div.warning.text-sm
                                "Invalid block value, please delete the current property."]]
                                "Invalid block value, please delete the current property."]]
           (when v-block
           (when v-block

+ 1 - 1
src/main/frontend/components/right_sidebar.cljs

@@ -102,7 +102,7 @@
         [[:.flex.items-center.page-title
         [[:.flex.items-center.page-title
           (if-let [icon (pu/get-block-property-value page :logseq.property/icon)]
           (if-let [icon (pu/get-block-property-value page :logseq.property/icon)]
             [:.text-md.mr-2 icon]
             [:.text-md.mr-2 icon]
-            (ui/icon (if (contains? (:block/type page) "whiteboard") "whiteboard" "page") {:class "text-md mr-2"}))
+            (ui/icon (if (= (:block/type page) "whiteboard") "whiteboard" "page") {:class "text-md mr-2"}))
           [:span.overflow-hidden.text-ellipsis (:block/title page)]]
           [:span.overflow-hidden.text-ellipsis (:block/title page)]]
          (page-cp repo (str (:block/uuid page)))]
          (page-cp repo (str (:block/uuid page)))]
         (block-with-breadcrumb repo page idx [repo db-id block-type] false)))
         (block-with-breadcrumb repo page idx [repo db-id block-type] false)))

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

@@ -1311,7 +1311,7 @@
   [block value opts]
   [block value opts]
   (let [entity (db/entity [:block/uuid (:block/uuid block)])]
   (let [entity (db/entity [:block/uuid (:block/uuid block)])]
     (when (and (:db/id entity)
     (when (and (:db/id entity)
-               (not (contains? (:block/type entity) "property")))
+               (not (= (:block/type entity) "property")))
       (let [value (string/trim value)]
       (let [value (string/trim value)]
         ;; FIXME: somehow frontend.components.editor's will-unmount event will loop forever
         ;; FIXME: somehow frontend.components.editor's will-unmount event will loop forever
         ;; maybe we shouldn't save the block/file in "will-unmount" event?
         ;; maybe we shouldn't save the block/file in "will-unmount" event?

+ 7 - 7
src/main/frontend/handler/page.cljs

@@ -247,16 +247,16 @@
   (let [graph-specific-hidden?
   (let [graph-specific-hidden?
         (if (config/db-based-graph? repo)
         (if (config/db-based-graph? repo)
           (fn [p]
           (fn [p]
-            (and (contains? (set (:block/type p)) "property") (ldb/built-in? p)))
+            (and (= (:block/type p) "property") (ldb/built-in? p)))
           (fn [p]
           (fn [p]
             (gp-db/built-in-pages-names (string/upper-case (:block/name p)))))]
             (gp-db/built-in-pages-names (string/upper-case (:block/name p)))))]
     (->> (db/get-all-pages repo)
     (->> (db/get-all-pages repo)
-        (remove (fn [p]
-                  (let [name (:block/name p)]
-                    (or (util/uuid-string? name)
-                        (common-config/draw? name)
-                        (graph-specific-hidden? p)))))
-        (common-handler/fix-pages-timestamps))))
+         (remove (fn [p]
+                   (let [name (:block/name p)]
+                     (or (util/uuid-string? name)
+                         (common-config/draw? name)
+                         (graph-specific-hidden? p)))))
+         (common-handler/fix-pages-timestamps))))
 
 
 (defn get-filters
 (defn get-filters
   [page]
   [page]

+ 3 - 3
src/main/frontend/handler/whiteboard.cljs

@@ -69,7 +69,7 @@
     {:db/id (:db/id page-entity)
     {:db/id (:db/id page-entity)
      :block/title page-name
      :block/title page-name
      :block/name (util/page-name-sanity-lc page-name)
      :block/name (util/page-name-sanity-lc page-name)
-     :block/type #{"page" "whiteboard"}
+     :block/type "whiteboard"
      :block/format :markdown
      :block/format :markdown
      :logseq.property/ls-type :whiteboard-page
      :logseq.property/ls-type :whiteboard-page
      :logseq.property.tldraw/page tldraw-page
      :logseq.property.tldraw/page tldraw-page
@@ -82,7 +82,7 @@
   (let [get-k #(gobj/get tldraw-page %)]
   (let [get-k #(gobj/get tldraw-page %)]
     {:block/title page-name
     {:block/title page-name
      :block/name (util/page-name-sanity-lc page-name)
      :block/name (util/page-name-sanity-lc page-name)
-     :block/type #{"page" "whiteboard"}
+     :block/type "whiteboard"
      :block/properties {(pu/get-pid :logseq.property/ls-type)
      :block/properties {(pu/get-pid :logseq.property/ls-type)
                         :whiteboard-page
                         :whiteboard-page
 
 
@@ -253,7 +253,7 @@
         m #:block{:uuid id
         m #:block{:uuid id
                   :name (util/page-name-sanity-lc page-name),
                   :name (util/page-name-sanity-lc page-name),
                   :title page-name
                   :title page-name
-                  :type #{"whiteboard" "page"},
+                  :type "whiteboard",
                   :format :markdown
                   :format :markdown
                   :updated-at (util/time-ms),
                   :updated-at (util/time-ms),
                   :created-at (util/time-ms)}
                   :created-at (util/time-ms)}

+ 5 - 3
src/main/frontend/worker/db/migrate.cljs

@@ -49,9 +49,11 @@
        :classes    []}]
        :classes    []}]
    [4 {:fix (fn [conn _search-db]
    [4 {:fix (fn [conn _search-db]
               (let [pages (d/datoms @conn :avet :block/name)
               (let [pages (d/datoms @conn :avet :block/name)
-                    tx-data (map (fn [d]
-                                   {:db/id (:e d)
-                                    :block/type "page"}) pages)]
+                    tx-data (keep (fn [d]
+                                    (let [entity (d/entity @conn (:e d))]
+                                      (when-not (:block/type entity)
+                                        {:db/id (:e d)
+                                         :block/type "page"}))) pages)]
                 tx-data))}]
                 tx-data))}]
    [5 {:properties [:logseq.property/view-for]
    [5 {:properties [:logseq.property/view-for]
        :classes    []}]
        :classes    []}]

+ 1 - 1
src/main/frontend/worker/export.cljs

@@ -39,7 +39,7 @@
               [?b :block/name]] db)
               [?b :block/name]] db)
 
 
        (map (fn [[page]]
        (map (fn [[page]]
-              (let [whiteboard? (contains? (set (:block/type page)) "whiteboard")
+              (let [whiteboard? (= (:block/type page) "whiteboard")
                     blocks (ldb/get-page-blocks db (:db/id page))
                     blocks (ldb/get-page-blocks db (:db/id page))
                     blocks' (if whiteboard?
                     blocks' (if whiteboard?
                               blocks
                               blocks

+ 1 - 1
src/main/frontend/worker/file.cljs

@@ -61,7 +61,7 @@
   [repo conn page-db-id outliner-op context request-id]
   [repo conn page-db-id outliner-op context request-id]
   (let [page-block (d/pull @conn '[*] page-db-id)
   (let [page-block (d/pull @conn '[*] page-db-id)
         page-db-id (:db/id page-block)
         page-db-id (:db/id page-block)
-        whiteboard? (contains? (set (:block/type page-block)) "whiteboard")
+        whiteboard? (= (:block/type page-block) "whiteboard")
         blocks-count (ldb/get-page-blocks-count @conn page-db-id)
         blocks-count (ldb/get-page-blocks-count @conn page-db-id)
         blocks-just-deleted? (and (zero? blocks-count)
         blocks-just-deleted? (and (zero? blocks-count)
                                   (contains? #{:delete-blocks :move-blocks} outliner-op))]
                                   (contains? #{:delete-blocks :move-blocks} outliner-op))]

+ 1 - 1
src/main/frontend/worker/file/core.cljs

@@ -164,7 +164,7 @@
         file-db-id (-> page-block :block/file :db/id)
         file-db-id (-> page-block :block/file :db/id)
         file-path (-> (d/entity db file-db-id) :file/path)
         file-path (-> (d/entity db file-db-id) :file/path)
         result (if (and (string? file-path) (not-empty file-path))
         result (if (and (string? file-path) (not-empty file-path))
-                 (let [new-content (if (contains? (set (:block/type page-block)) "whiteboard")
+                 (let [new-content (if (= (:block/type page-block) "whiteboard")
                                      (->
                                      (->
                                       (wfu/ugly-pr-str {:blocks tree
                                       (wfu/ugly-pr-str {:blocks tree
                                                         :pages (list (remove-transit-ids page-block))})
                                                         :pages (list (remove-transit-ids page-block))})

+ 1 - 1
src/main/frontend/worker/handler/page.cljs

@@ -75,7 +75,7 @@
                                      blocks)
                                      blocks)
             db-based? (sqlite-util/db-based-graph? repo)]
             db-based? (sqlite-util/db-based-graph? repo)]
         ;; TODO: maybe we should add $$$favorites to built-in pages?
         ;; TODO: maybe we should add $$$favorites to built-in pages?
-        (if (or (ldb/built-in? page) (contains? (:block/type page) "hidden"))
+        (if (or (ldb/built-in? page) (= (:block/type page) "hidden"))
           (do
           (do
             (error-handler {:msg "Built-in page cannot be deleted"})
             (error-handler {:msg "Built-in page cannot be deleted"})
             false)
             false)

+ 1 - 2
src/main/frontend/worker/handler/page/db_based/page.cljs

@@ -15,8 +15,7 @@
 
 
 (defn- build-page-tx [conn properties page {:keys [whiteboard? class? tags]}]
 (defn- build-page-tx [conn properties page {:keys [whiteboard? class? tags]}]
   (when (:block/uuid page)
   (when (:block/uuid page)
-    (let [page (update page :block/type
-                       (fn [types] (if whiteboard? (conj types "whiteboard") types)))
+    (let [page (assoc page :block/type (cond class? "class" whiteboard? "whiteboard" :else "page"))
           page' (merge page
           page' (merge page
                        (when tags {:block/tags (mapv #(hash-map :db/id
                        (when tags {:block/tags (mapv #(hash-map :db/id
                                                                 (:db/id (d/entity @conn [:block/uuid %])))
                                                                 (:db/id (d/entity @conn [:block/uuid %])))

+ 1 - 1
src/main/frontend/worker/handler/page/file_based/page.cljs

@@ -31,7 +31,7 @@
   (when (:block/uuid page)
   (when (:block/uuid page)
     (let [page-entity   [:block/uuid (:block/uuid page)]
     (let [page-entity   [:block/uuid (:block/uuid page)]
           page'          (merge page
           page'          (merge page
-                                (when whiteboard? {:block/type #{"page" "whiteboard"}})
+                                (when whiteboard? {:block/type "whiteboard"})
                                 (when tags {:block/tags (mapv #(hash-map :db/id
                                 (when tags {:block/tags (mapv #(hash-map :db/id
                                                                          (:db/id (d/entity @conn [:block/uuid %])))
                                                                          (:db/id (d/entity @conn [:block/uuid %])))
                                                               tags)}))
                                                               tags)}))

+ 2 - 2
src/main/frontend/worker/handler/page/file_based/rename.cljs

@@ -319,8 +319,8 @@
       :invalid-empty-name
       :invalid-empty-name
 
 
       (and page-e new-page-e
       (and page-e new-page-e
-           (or (contains? (:block/type page-e) "whiteboard")
-               (contains? (:block/type new-page-e) "whiteboard")))
+           (or (= (:block/type page-e) "whiteboard")
+               (= (:block/type new-page-e) "whiteboard")))
       :merge-whiteboard-pages
       :merge-whiteboard-pages
 
 
       (and old-name new-name name-changed?)
       (and old-name new-name name-changed?)

+ 1 - 1
src/main/frontend/worker/rtc/asset_db_listener.cljs

@@ -12,7 +12,7 @@
     (let [ent (d/entity db-after e)
     (let [ent (d/entity db-after e)
           block-uuid (:block/uuid ent)
           block-uuid (:block/uuid ent)
           block-type (:block/type ent)]
           block-type (:block/type ent)]
-      (when (and block-uuid (contains? (set block-type) "asset"))
+      (when (and block-uuid (= block-type "asset"))
         (when-let [action (r.asset/asset-block->upload+download-action ent)]
         (when-let [action (r.asset/asset-block->upload+download-action ent)]
           [action block-uuid])))))
           [action block-uuid])))))
 
 

+ 3 - 4
src/main/frontend/worker/rtc/db_listener.cljs

@@ -76,8 +76,8 @@
 (defn- entity-datoms=>ops
 (defn- entity-datoms=>ops
   [db-before db-after e->a->add?->v->t entity-datoms]
   [db-before db-after e->a->add?->v->t entity-datoms]
   (let [e                        (ffirst entity-datoms)
   (let [e                        (ffirst entity-datoms)
-        {block-uuid :block/uuid
-         block-type :block/type} (d/entity db-after e)
+        entity                   (d/entity db-after e)
+        {block-uuid :block/uuid} entity
         a->add?->v->t            (e->a->add?->v->t e)
         a->add?->v->t            (e->a->add?->v->t e)
         {add?->block-name->t   :block/name
         {add?->block-name->t   :block/name
          add?->block-title->t  :block/title
          add?->block-title->t  :block/title
@@ -107,8 +107,7 @@
                   (conj [:move (or t4 t5) {:block-uuid block-uuid}])
                   (conj [:move (or t4 t5) {:block-uuid block-uuid}])
 
 
                   (or add-block-name
                   (or add-block-name
-                      (and (contains? block-type "page")
-                           add-block-title))
+                      (and (ldb/page? entity) add-block-title))
                   (conj [:update-page (or t2 t3) {:block-uuid block-uuid}]))
                   (conj [:update-page (or t2 t3) {:block-uuid block-uuid}]))
             update-op (when-let [av-coll (not-empty (update-op-av-coll db-before db-after a->add?->v->t*))]
             update-op (when-let [av-coll (not-empty (update-op-av-coll db-before db-after a->add?->v->t*))]
                         (let [t (max-t a->add?->v->t*)]
                         (let [t (max-t a->add?->v->t*)]

+ 3 - 7
src/main/frontend/worker/rtc/remote_update.cljs

@@ -129,17 +129,13 @@
   (ldb/transact! conn blocks {:persist-op? false
   (ldb/transact! conn blocks {:persist-op? false
                               :gen-undo-ops? false}))
                               :gen-undo-ops? false}))
 
 
-(defn- whiteboard-page-block?
-  [block]
-  (contains? (set (:block/type block)) "whiteboard"))
-
 (defn- group-remote-remove-ops-by-whiteboard-block
 (defn- group-remote-remove-ops-by-whiteboard-block
   "return {true [<whiteboard-block-ops>], false [<other-ops>]}"
   "return {true [<whiteboard-block-ops>], false [<other-ops>]}"
   [db remote-remove-ops]
   [db remote-remove-ops]
   (group-by (fn [{:keys [block-uuid]}]
   (group-by (fn [{:keys [block-uuid]}]
               (boolean
               (boolean
                (when-let [block (d/entity db [:block/uuid block-uuid])]
                (when-let [block (d/entity db [:block/uuid block-uuid])]
-                 (whiteboard-page-block? (:block/parent block)))))
+                 (ldb/whiteboard-page? (:block/parent block)))))
             remote-remove-ops))
             remote-remove-ops))
 
 
 (defn- apply-remote-remove-ops-helper
 (defn- apply-remote-remove-ops-helper
@@ -186,7 +182,7 @@
   (when (seq remote-parents)
   (when (seq remote-parents)
     (let [first-remote-parent (first remote-parents)
     (let [first-remote-parent (first remote-parents)
           local-parent (d/entity @conn [:block/uuid first-remote-parent])
           local-parent (d/entity @conn [:block/uuid first-remote-parent])
-          whiteboard-page-block? (whiteboard-page-block? local-parent)
+          whiteboard-page-block? (ldb/whiteboard-page? local-parent)
           b (d/entity @conn [:block/uuid block-uuid])]
           b (d/entity @conn [:block/uuid block-uuid])]
       (case [whiteboard-page-block? (some? local-parent) (some? remote-block-order)]
       (case [whiteboard-page-block? (some? local-parent) (some? remote-block-order)]
         [false true true]
         [false true true]
@@ -459,7 +455,7 @@
       (let [{update-block-order-tx-data :tx-data op-value :op-value} (update-block-order (:db/id ent) op-value)
       (let [{update-block-order-tx-data :tx-data op-value :op-value} (update-block-order (:db/id ent) op-value)
             first-remote-parent (first parents)
             first-remote-parent (first parents)
             local-parent (d/entity @conn [:block/uuid first-remote-parent])
             local-parent (d/entity @conn [:block/uuid first-remote-parent])
-            whiteboard-page-block? (whiteboard-page-block? local-parent)]
+            whiteboard-page-block? (ldb/whiteboard-page? local-parent)]
         (if whiteboard-page-block?
         (if whiteboard-page-block?
           (upsert-whiteboard-block repo conn op-value)
           (upsert-whiteboard-block repo conn op-value)
           (do (when-let [schema-tx-data (remote-op-value->schema-tx-data block-uuid op-value)]
           (do (when-let [schema-tx-data (remote-op-value->schema-tx-data block-uuid op-value)]

+ 2 - 2
src/main/frontend/worker/search.cljs

@@ -180,7 +180,7 @@ DROP TRIGGER IF EXISTS blocks_au;
   (when page
   (when page
     (if (string? page)
     (if (string? page)
       (string/starts-with? page "$$$")
       (string/starts-with? page "$$$")
-      (contains? (set (:block/type page)) "hidden"))))
+      (= (:block/type page) "hidden"))))
 
 
 (defn- page-or-object?
 (defn- page-or-object?
   [entity]
   [entity]
@@ -318,7 +318,7 @@ DROP TRIGGER IF EXISTS blocks_au;
   (defn- property-value-when-closed
   (defn- property-value-when-closed
     "Returns property value if the given entity is type 'closed value' or nil"
     "Returns property value if the given entity is type 'closed value' or nil"
     [ent]
     [ent]
-    (when (contains? (:block/type ent) "closed value")
+    (when (= (:block/type ent) "closed value")
       (:block/title ent))))
       (:block/title ent))))
 
 
 (comment
 (comment

+ 2 - 2
src/test/frontend/worker/rtc/client_test.cljs

@@ -16,7 +16,7 @@
                                    :block/created-at 1720017595872,
                                    :block/created-at 1720017595872,
                                    :block/format :markdown,
                                    :block/format :markdown,
                                    :db/ident :user.class/yyy,
                                    :db/ident :user.class/yyy,
-                                   :block/type ["class"],
+                                   :block/type "class",
                                    :block/name "yyy",
                                    :block/name "yyy",
                                    :block/title "yyy"}])]
                                    :block/title "yyy"}])]
       (is (= {:update
       (is (= {:update
@@ -50,7 +50,7 @@
                                    :block/format :markdown
                                    :block/format :markdown
                                    :db/cardinality :db.cardinality/one
                                    :db/cardinality :db.cardinality/one
                                    :db/ident :user.property/xxx,
                                    :db/ident :user.property/xxx,
-                                   :block/type #{"property"},
+                                   :block/type "property",
                                    :block/order block-order,
                                    :block/order block-order,
                                    :block/name "xxx",
                                    :block/name "xxx",
                                    :block/title "xxx"}])]
                                    :block/title "xxx"}])]

部分文件因为文件数量过多而无法显示