diff --git a/Cargo.lock b/Cargo.lock index a4468dc7..52437938 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1386,7 +1386,7 @@ dependencies = [ [[package]] name = "collab" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6c8931dabb793181f54b16d7aba6f795055b92cb#6c8931dabb793181f54b16d7aba6f795055b92cb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ba46c5e9e39049c4fedd6f3d67410368874b324f#ba46c5e9e39049c4fedd6f3d67410368874b324f" dependencies = [ "anyhow", "async-trait", @@ -1409,7 +1409,7 @@ dependencies = [ [[package]] name = "collab-document" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6c8931dabb793181f54b16d7aba6f795055b92cb#6c8931dabb793181f54b16d7aba6f795055b92cb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ba46c5e9e39049c4fedd6f3d67410368874b324f#ba46c5e9e39049c4fedd6f3d67410368874b324f" dependencies = [ "anyhow", "collab", @@ -1428,7 +1428,7 @@ dependencies = [ [[package]] name = "collab-entity" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6c8931dabb793181f54b16d7aba6f795055b92cb#6c8931dabb793181f54b16d7aba6f795055b92cb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ba46c5e9e39049c4fedd6f3d67410368874b324f#ba46c5e9e39049c4fedd6f3d67410368874b324f" dependencies = [ "anyhow", "bytes", @@ -1443,7 +1443,7 @@ dependencies = [ [[package]] name = "collab-folder" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=6c8931dabb793181f54b16d7aba6f795055b92cb#6c8931dabb793181f54b16d7aba6f795055b92cb" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ba46c5e9e39049c4fedd6f3d67410368874b324f#ba46c5e9e39049c4fedd6f3d67410368874b324f" dependencies = [ "anyhow", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 0baa1ba3..94a45793 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -175,10 +175,10 @@ inherits = "release" debug = true [patch.crates-io] -collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6c8931dabb793181f54b16d7aba6f795055b92cb" } -collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6c8931dabb793181f54b16d7aba6f795055b92cb" } -collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6c8931dabb793181f54b16d7aba6f795055b92cb" } -collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "6c8931dabb793181f54b16d7aba6f795055b92cb" } +collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ba46c5e9e39049c4fedd6f3d67410368874b324f" } +collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ba46c5e9e39049c4fedd6f3d67410368874b324f" } +collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ba46c5e9e39049c4fedd6f3d67410368874b324f" } +collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ba46c5e9e39049c4fedd6f3d67410368874b324f" } [features] custom_env= [] diff --git a/libs/client-api-test-util/src/test_client.rs b/libs/client-api-test-util/src/test_client.rs index 44bd55d9..ef7be2ec 100644 --- a/libs/client-api-test-util/src/test_client.rs +++ b/libs/client-api-test-util/src/test_client.rs @@ -493,13 +493,14 @@ impl TestClient { let (sink, stream) = (handler.sink(), handler.stream()); let origin = CollabOrigin::Client(CollabClient::new(self.uid().await, self.device_id.clone())); let collab = match encoded_collab_v1 { - None => Arc::new(MutexCollab::new(origin.clone(), &object_id, vec![])), + None => Arc::new(MutexCollab::new(origin.clone(), &object_id, vec![], false)), Some(data) => Arc::new( MutexCollab::new_with_doc_state( origin.clone(), &object_id, data.doc_state.to_vec(), vec![], + false, ) .unwrap(), ), @@ -574,7 +575,7 @@ impl TestClient { let (sink, stream) = (handler.sink(), handler.stream()); let origin = CollabOrigin::Client(CollabClient::new(self.uid().await, self.device_id.clone())); let collab = Arc::new( - MutexCollab::new_with_doc_state(origin.clone(), object_id, doc_state, vec![]).unwrap(), + MutexCollab::new_with_doc_state(origin.clone(), object_id, doc_state, vec![], false).unwrap(), ); let ws_connect_state = self.ws_client.subscribe_connect_state(); @@ -661,6 +662,7 @@ pub async fn assert_server_snapshot( &object_id, encoded_collab_v1.doc_state.to_vec(), vec![], + false, ) .unwrap() .to_json_value(); @@ -718,6 +720,7 @@ pub async fn assert_server_collab( &object_id, data.doc_state.to_vec(), vec![], + false, ) .unwrap() .to_json_value(); @@ -838,6 +841,7 @@ pub async fn get_collab_json_from_server( object_id, bytes.doc_state.to_vec(), vec![], + false, ) .unwrap() .to_json_value() diff --git a/libs/realtime/src/server/collaborate/all_group.rs b/libs/realtime/src/server/collaborate/all_group.rs index 0860e6c7..e5fdf85a 100644 --- a/libs/realtime/src/server/collaborate/all_group.rs +++ b/libs/realtime/src/server/collaborate/all_group.rs @@ -100,7 +100,7 @@ where object_id: &str, collab_type: CollabType, ) { - let mut collab = Collab::new_with_origin(CollabOrigin::Server, object_id, vec![]); + let mut collab = Collab::new_with_origin(CollabOrigin::Server, object_id, vec![], false); let plugin = CollabStoragePlugin::new( uid, workspace_id, diff --git a/libs/realtime/src/server/collaborate/plugin.rs b/libs/realtime/src/server/collaborate/plugin.rs index 0303f588..cd14a36c 100644 --- a/libs/realtime/src/server/collaborate/plugin.rs +++ b/libs/realtime/src/server/collaborate/plugin.rs @@ -290,6 +290,7 @@ where object_id, encoded_collab.doc_state.to_vec(), vec![], + false, ) { match collab_type { CollabType::Document => { diff --git a/libs/workspace-template/src/document/get_started.rs b/libs/workspace-template/src/document/get_started.rs index 72bd9ad1..89dde5f3 100644 --- a/libs/workspace-template/src/document/get_started.rs +++ b/libs/workspace-template/src/document/get_started.rs @@ -40,7 +40,12 @@ impl WorkspaceTemplate for GetStartedDocumentTemplate { let data = tokio::task::spawn_blocking(|| { let json_str = include_str!("../../assets/read_me.json"); let document_data = JsonToDocumentParser::json_str_to_document(json_str).unwrap(); - let collab = Arc::new(MutexCollab::new(CollabOrigin::Empty, &view_id, vec![])); + let collab = Arc::new(MutexCollab::new( + CollabOrigin::Empty, + &view_id, + vec![], + false, + )); let document = Document::create_with_data(collab, document_data)?; let data = document.get_collab().encode_collab_v1(); Ok::<_, anyhow::Error>(TemplateData { diff --git a/libs/workspace-template/src/lib.rs b/libs/workspace-template/src/lib.rs index d09242d2..0d459a05 100644 --- a/libs/workspace-template/src/lib.rs +++ b/libs/workspace-template/src/lib.rs @@ -117,7 +117,12 @@ impl WorkspaceTemplateBuilder { trash: Default::default(), }; - let collab = Arc::new(MutexCollab::new(CollabOrigin::Empty, &workspace_id, vec![])); + let collab = Arc::new(MutexCollab::new( + CollabOrigin::Empty, + &workspace_id, + vec![], + false, + )); let folder = Folder::create(uid, collab, None, folder_data); let data = folder.encode_collab_v1(); Ok::<_, anyhow::Error>(TemplateData { diff --git a/src/biz/collab/storage.rs b/src/biz/collab/storage.rs index 38370eec..38232d0a 100644 --- a/src/biz/collab/storage.rs +++ b/src/biz/collab/storage.rs @@ -309,6 +309,7 @@ pub fn check_encoded_collab_data(object_id: &str, data: &[u8]) -> Result<(), any object_id, encoded_collab.doc_state.to_vec(), vec![], + false, )?; Ok(()) } diff --git a/tests/collab/util.rs b/tests/collab/util.rs index 34bca885..90171b58 100644 --- a/tests/collab/util.rs +++ b/tests/collab/util.rs @@ -25,13 +25,13 @@ pub fn generate_random_string(len: usize) -> String { } pub fn make_big_collab_doc_state(object_id: &str, key: &str, value: String) -> Vec { - let collab = Collab::new_with_origin(CollabOrigin::Empty, object_id, vec![]); + let collab = Collab::new_with_origin(CollabOrigin::Empty, object_id, vec![], false); collab.insert(key, value); collab.encode_collab_v1().doc_state.to_vec() } pub fn test_encode_collab_v1(object_id: &str, key: &str, value: &str) -> EncodedCollab { - let collab = Collab::new_with_origin(CollabOrigin::Empty, object_id, vec![]); + let collab = Collab::new_with_origin(CollabOrigin::Empty, object_id, vec![], false); collab.insert(key, value); collab.encode_collab_v1() } diff --git a/tests/collab_snapshot/snapshot_test.rs b/tests/collab_snapshot/snapshot_test.rs index 9a1ebdb9..3399066c 100644 --- a/tests/collab_snapshot/snapshot_test.rs +++ b/tests/collab_snapshot/snapshot_test.rs @@ -87,6 +87,7 @@ async fn get_snapshot_data_test() { &object_id, encoded_collab.doc_state.to_vec(), vec![], + false, ) .unwrap(); let json = collab.to_json_value(); @@ -136,7 +137,7 @@ async fn snapshot_limit_test() { } fn test_collab_data(uid: i64, oid: &str) -> (EncodedCollab, Value) { - let collab = Collab::new(uid, oid, "fake_device_id", vec![]); + let collab = Collab::new(uid, oid, "fake_device_id", vec![], false); collab.with_origin_transact_mut(|txn| { collab.insert_with_txn(txn, "0", "a"); collab.insert_with_txn(txn, "1", "b");