From 0523c701278d5e5820c58213911e2fc0928aad60 Mon Sep 17 00:00:00 2001 From: Olaf Wintermann Date: Sat, 15 Aug 2026 10:23:49 +0200 Subject: [PATCH] add read_only field to collection model --- application/note/src/notebook.rs | 3 ++- entity/src/collection.rs | 3 ++- migration/src/m20260502_184134_create_settings.rs | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/application/note/src/notebook.rs b/application/note/src/notebook.rs index a091dfa..9f0df0f 100644 --- a/application/note/src/notebook.rs +++ b/application/note/src/notebook.rs @@ -519,7 +519,8 @@ impl NotebookItem { pub fn load_notebook(&mut self, backend: &BackendHandle) -> UiDoc { // Create Notebook UI model - let notebook = Notebook::new(self.data.collection_id, backend); + let mut notebook = Notebook::new(self.data.collection_id, backend); + notebook.read_only = self.data.read_only; let doc = notebook.into_doc(); self.model = Some(doc.clone()); diff --git a/entity/src/collection.rs b/entity/src/collection.rs index f898178..b85d729 100644 --- a/entity/src/collection.rs +++ b/entity/src/collection.rs @@ -45,7 +45,8 @@ pub struct Model { pub parent: String, pub icon: Option, pub kind: CollectionType, - pub storage: LocalStorageSetting + pub storage: LocalStorageSetting, + pub read_only: bool, } impl Model { diff --git a/migration/src/m20260502_184134_create_settings.rs b/migration/src/m20260502_184134_create_settings.rs index 7517da9..c91f191 100644 --- a/migration/src/m20260502_184134_create_settings.rs +++ b/migration/src/m20260502_184134_create_settings.rs @@ -46,6 +46,7 @@ impl MigrationTrait for Migration { .col(string_null("icon")) .col(integer("kind")) .col(integer("storage").default(0)) + .col(boolean("read_only").default(false)) .foreign_key( ForeignKey::create() .name("fk-collection-profile") -- 2.52.0