Kaynağa Gözat

chore: use internal-page? helper

Gabriel Horner 1 yıl önce
ebeveyn
işleme
830c275d54

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

@@ -473,7 +473,7 @@
   [page]
   (cond (property? page)
         (not (public-built-in-property? page))
-        (or (class? page) (= "page" (:block/type page)))
+        (or (class? page) (internal-page? page))
         false
         ;; Default to true for closed value and future internal types.
         ;; Other types like whiteboard are not considered because they aren't built-in

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

@@ -813,7 +813,7 @@
                                                                 m))
                                  block-changes (cond-> (select-keys m allowed-attributes)
                                                  ;; disallow any type -> "page" but do allow any conversion to a non-page type
-                                                 (= (:block/type m) "page")
+                                                 (ldb/internal-page? m)
                                                  (dissoc :block/type))]
                              (when-let [ignored-attrs (not-empty (apply dissoc m (into disallowed-attributes allowed-attributes)))]
                                (notify-user {:msg (str "Import ignored the following attributes on page " (pr-str (:block/title m)) ": "

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

@@ -182,7 +182,7 @@
       (is (= 8
              (count (->> (d/q '[:find [(pull ?b [:block/title :block/type]) ...]
                                 :where [?b :block/title] [_ :block/page ?b]] @conn)
-                         (filter #(= "page" (:block/type %))))))
+                         (filter ldb/internal-page?))))
           "Correct number of pages with block content")
       (is (= 4 (count (d/datoms @conn :avet :block/type "whiteboard"))))
       (is (= 1 (count @(:ignored-properties import-state))) ":filters should be the only ignored property")

+ 1 - 1
deps/outliner/src/logseq/outliner/validate.cljs

@@ -68,7 +68,7 @@
 (defn- validate-unique-for-page
   [db new-title {:block/keys [tags] :as entity}]
   (cond
-    (and (seq tags) (= "page" (:block/type entity)))
+    (and (seq tags) (ldb/internal-page? entity))
     (when-let [res (seq (d/q '[:find [?b ...]
                                :in $ ?eid ?title [?tag-id ...]
                                :where

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

@@ -155,7 +155,7 @@
                :options {:on-click #(commands/exec-plugin-simple-command!
                                      pid (assoc cmd :page page-name) action)}}))
 
-          (when (and db-based? (= (:block/type page) "page"))
+          (when (and db-based? (ldb/internal-page? page))
             {:title (t :page/convert-to-tag)
              :options {:on-click (fn []
                                    (db-page-handler/convert-to-tag! page))}})

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

@@ -350,7 +350,7 @@
                    (and (= :logseq.property/parent (:db/ident property))
                         (ldb/class? block)))
         ;; Note: property and other types shouldn't be converted to class
-        page? (= "page" (:block/type page-entity))]
+        page? (ldb/internal-page? page-entity)]
     (cond
       ;; page not exists or page exists but not a page type
       (or (nil? id) (and class? (not page?)))