From 3ebcfcd3d2f1b02adc86979d2c83924934b5de36 Mon Sep 17 00:00:00 2001 From: Gabriel Horner Date: Mon, 9 Oct 2023 11:44:03 -0400 Subject: [PATCH] fix: hidden pages showing up in all pages and probably other places Also updated schema to reflect new multi-line :default prop vals implementation --- .../tasks/db_graph/validate_client_db.cljs | 44 +++++-------------- src/main/frontend/db/model.cljs | 2 +- 2 files changed, 13 insertions(+), 33 deletions(-) diff --git a/scripts/src/logseq/tasks/db_graph/validate_client_db.cljs b/scripts/src/logseq/tasks/db_graph/validate_client_db.cljs index ddf3a205a6..75f0b433f9 100644 --- a/scripts/src/logseq/tasks/db_graph/validate_client_db.cljs +++ b/scripts/src/logseq/tasks/db_graph/validate_client_db.cljs @@ -41,7 +41,7 @@ "Common attributes for pages" [[:block/name :string] [:block/original-name :string] - [:block/type {:optional true} [:enum #{"property"} #{"class"} #{"object"} #{"whiteboard"}]] + [:block/type {:optional true} [:enum #{"property"} #{"class"} #{"object"} #{"whiteboard"} #{"hidden"}]] [:block/journal? :boolean] ;; TODO: Consider moving to just normal and class after figuring out journal attributes [:block/format {:optional true} [:enum :markdown]] @@ -126,47 +126,28 @@ [#{"object"} object-page] [::m/default normal-page]]) -(def block-attrs - "Common attributes for normal blocks" - (into - ;; refs - [[:block/page :int] - [:block/path-refs {:optional true} [:set :int]] - [:block/link {:optional true} :int] - ;; other - [:block/format [:enum :markdown]] - [:block/marker {:optional true} :string] - [:block/priority {:optional true} :string] - [:block/collapsed? {:optional true} :boolean]] - page-or-block-attrs)) - (def normal-block "A normal block is a block with content and a page" (vec (concat [:map {:closed false}] - block-attrs [[:block/content :string] [:block/left :int] [:block/parent :int] [:block/metadata {:optional true} [:map {:closed false} [:created-from-block :uuid] - [:created-from-property :uuid]]]]))) - -(def normal-empty-block - "This empty block is created when a default property value has multiple - blocks. This block doesn't have :block/left or :block/parent attributes. - Unclear if this is intentional" - (vec - (concat - [:map {:closed false}] - block-attrs - [[:block/content [:= ""]] - [:block/metadata - [:map {:closed false} - [:created-from-block :uuid] - [:created-from-property :uuid]]]]))) + [:created-from-property :uuid]]] + ;; refs + [:block/page :int] + [:block/path-refs {:optional true} [:set :int]] + [:block/link {:optional true} :int] + ;; other + [:block/format [:enum :markdown]] + [:block/marker {:optional true} :string] + [:block/priority {:optional true} :string] + [:block/collapsed? {:optional true} :boolean]] + page-or-block-attrs))) ;; TODO: Figure out where this is coming from (def unknown-empty-block @@ -187,7 +168,6 @@ [:or page-block normal-block - normal-empty-block file-block unknown-empty-block]]) diff --git a/src/main/frontend/db/model.cljs b/src/main/frontend/db/model.cljs index 5da367fba3..8e2f736303 100644 --- a/src/main/frontend/db/model.cljs +++ b/src/main/frontend/db/model.cljs @@ -115,7 +115,7 @@ (if (string? page) (and (string/starts-with? page "$$$") (util/uuid-string? (gp-util/safe-subs page 3))) - (contains? (:block/type page) "hidden"))) + (contains? (set (:block/type page)) "hidden"))) (defn get-pages [repo]