Browse Source

fix: built-in page converts to tag

from editor. Another fix for
https://github.com/logseq/db-test/issues/333
Gabriel Horner 8 months ago
parent
commit
b22e5af239

+ 5 - 0
deps/outliner/src/logseq/outliner/core.cljs

@@ -284,6 +284,11 @@
                        (:block/title m*)
                        (not= (:block/title m*) (:block/title block-entity)))
               (outliner-validate/validate-block-title db (:block/title m*) block-entity))
+          _ (when (and db-based? (seq (:block/tags m*)))
+              ;; Add built-in? b/c it's not available here
+              (doseq [tag (map #(assoc % :logseq.property/built-in?
+                                       (contains? sqlite-create-graph/built-in-pages-names (:block/title %))) (:block/tags m*))]
+                (outliner-validate/validate-built-in-pages tag {:message "Built-in page can't be a tag"})))
           m (cond-> m*
               db-based?
               (dissoc :block/format :block/pre-block? :block/priority :block/marker :block/properties-order))]

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

@@ -41,11 +41,11 @@
 
 (defn ^:api validate-built-in-pages
   "Validates built-in pages shouldn't be modified"
-  [entity]
+  [entity & {:keys [message]}]
   (when (uneditable-page? entity)
     (throw (ex-info "Rename built-in pages"
                     {:type :notification
-                     :payload {:message "Built-in pages can't be edited"
+                     :payload {:message (or message "Built-in pages can't be edited")
                                :type :warning}}))))
 
 (defn- validate-unique-by-extends-and-name [db entity new-title]