fix: revert disallowed built-in block updates

1. built-in pages (non-classes) shouldn't be used as tags
2. some protected properties for built-in nodes shouldn't be updated,
e.g. db/ident, block/title, block/name, logseq.property/type
This commit is contained in:
Tienson Qin
2025-11-04 21:49:26 +08:00
parent 79f670f799
commit e4e8388588
8 changed files with 97 additions and 32 deletions

View File

@@ -327,11 +327,6 @@
(: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))]

View File

@@ -39,15 +39,6 @@
(def ^:api uneditable-page? ldb/built-in?)
(defn ^:api validate-built-in-pages
"Validates built-in pages shouldn't be modified"
[entity & {:keys [message]}]
(when (uneditable-page? entity)
(throw (ex-info "Rename built-in pages"
{:type :notification
:payload {:message (or message "Built-in pages can't be edited")
:type :warning}}))))
(defn- find-other-ids-with-title-and-tags
"Query that finds other ids given the id to ignore, title to look up and tags to consider"
[entity]
@@ -138,7 +129,6 @@
(defn validate-block-title
"Validates a block title when it has changed for a entity-util/page? or tagged node"
[db new-title existing-block-entity]
(validate-built-in-pages existing-block-entity)
(validate-unique-by-name-and-tags db new-title existing-block-entity)
(validate-disallow-page-with-journal-name new-title existing-block-entity))