Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

chore: bump collab id

Nathan24d57336a979
diff --git a/frontend/rust-lib/Cargo.lock b/frontend/rust-lib/Cargo.lock
index e10038c7d3..baa5c5ee6d 100644
--- a/frontend/rust-lib/Cargo.lock
+++ b/frontend/rust-lib/Cargo.lock
@@ -1248,7 +1248,7 @@ dependencies = [
[[package]]
name = "collab"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4a0e2cc07f50f17d1b6605c579e622a431e94998#4a0e2cc07f50f17d1b6605c579e622a431e94998"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4e717c2c6a15c42feda9e1ff1b122c7b0baf1821#4e717c2c6a15c42feda9e1ff1b122c7b0baf1821"
dependencies = [
"anyhow",
"arc-swap",
@@ -1273,7 +1273,7 @@ dependencies = [
[[package]]
name = "collab-database"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4a0e2cc07f50f17d1b6605c579e622a431e94998#4a0e2cc07f50f17d1b6605c579e622a431e94998"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4e717c2c6a15c42feda9e1ff1b122c7b0baf1821#4e717c2c6a15c42feda9e1ff1b122c7b0baf1821"
dependencies = [
"anyhow",
"async-trait",
@@ -1313,7 +1313,7 @@ dependencies = [
[[package]]
name = "collab-document"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4a0e2cc07f50f17d1b6605c579e622a431e94998#4a0e2cc07f50f17d1b6605c579e622a431e94998"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4e717c2c6a15c42feda9e1ff1b122c7b0baf1821#4e717c2c6a15c42feda9e1ff1b122c7b0baf1821"
dependencies = [
"anyhow",
"arc-swap",
@@ -1334,7 +1334,7 @@ dependencies = [
[[package]]
name = "collab-entity"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4a0e2cc07f50f17d1b6605c579e622a431e94998#4a0e2cc07f50f17d1b6605c579e622a431e94998"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4e717c2c6a15c42feda9e1ff1b122c7b0baf1821#4e717c2c6a15c42feda9e1ff1b122c7b0baf1821"
dependencies = [
"anyhow",
"bytes",
@@ -1354,7 +1354,7 @@ dependencies = [
[[package]]
name = "collab-folder"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4a0e2cc07f50f17d1b6605c579e622a431e94998#4a0e2cc07f50f17d1b6605c579e622a431e94998"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4e717c2c6a15c42feda9e1ff1b122c7b0baf1821#4e717c2c6a15c42feda9e1ff1b122c7b0baf1821"
dependencies = [
"anyhow",
"arc-swap",
@@ -1376,7 +1376,7 @@ dependencies = [
[[package]]
name = "collab-importer"
version = "0.1.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4a0e2cc07f50f17d1b6605c579e622a431e94998#4a0e2cc07f50f17d1b6605c579e622a431e94998"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4e717c2c6a15c42feda9e1ff1b122c7b0baf1821#4e717c2c6a15c42feda9e1ff1b122c7b0baf1821"
dependencies = [
"anyhow",
"async-recursion",
@@ -1439,7 +1439,7 @@ dependencies = [
[[package]]
name = "collab-plugins"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4a0e2cc07f50f17d1b6605c579e622a431e94998#4a0e2cc07f50f17d1b6605c579e622a431e94998"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4e717c2c6a15c42feda9e1ff1b122c7b0baf1821#4e717c2c6a15c42feda9e1ff1b122c7b0baf1821"
dependencies = [
"anyhow",
"async-stream",
@@ -1517,7 +1517,7 @@ dependencies = [
[[package]]
name = "collab-user"
version = "0.2.0"
-source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4a0e2cc07f50f17d1b6605c579e622a431e94998#4a0e2cc07f50f17d1b6605c579e622a431e94998"
+source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=4e717c2c6a15c42feda9e1ff1b122c7b0baf1821#4e717c2c6a15c42feda9e1ff1b122c7b0baf1821"
dependencies = [
"anyhow",
"collab",
diff --git a/frontend/rust-lib/Cargo.toml b/frontend/rust-lib/Cargo.toml
index e3cb5a4178..78f67f8f90 100644
--- a/frontend/rust-lib/Cargo.toml
+++ b/frontend/rust-lib/Cargo.toml
@@ -139,14 +139,14 @@ rocksdb = { git = "https://github.com/rust-rocksdb/rust-rocksdb", rev = "1710120
# To switch to the local path, run:
# scripts/tool/update_collab_source.sh
# ⚠️⚠️⚠️️
-collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4a0e2cc07f50f17d1b6605c579e622a431e94998" }
-collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4a0e2cc07f50f17d1b6605c579e622a431e94998" }
-collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4a0e2cc07f50f17d1b6605c579e622a431e94998" }
-collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4a0e2cc07f50f17d1b6605c579e622a431e94998" }
-collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4a0e2cc07f50f17d1b6605c579e622a431e94998" }
-collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4a0e2cc07f50f17d1b6605c579e622a431e94998" }
-collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4a0e2cc07f50f17d1b6605c579e622a431e94998" }
-collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4a0e2cc07f50f17d1b6605c579e622a431e94998" }
+collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4e717c2c6a15c42feda9e1ff1b122c7b0baf1821" }
+collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4e717c2c6a15c42feda9e1ff1b122c7b0baf1821" }
+collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4e717c2c6a15c42feda9e1ff1b122c7b0baf1821" }
+collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4e717c2c6a15c42feda9e1ff1b122c7b0baf1821" }
+collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4e717c2c6a15c42feda9e1ff1b122c7b0baf1821" }
+collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4e717c2c6a15c42feda9e1ff1b122c7b0baf1821" }
+collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4e717c2c6a15c42feda9e1ff1b122c7b0baf1821" }
+collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "4e717c2c6a15c42feda9e1ff1b122c7b0baf1821" }
# Working directory: frontend
# To update the commit ID, run:
diff --git a/frontend/rust-lib/collab-integrate/src/collab_builder.rs b/frontend/rust-lib/collab-integrate/src/collab_builder.rs
index 226a5b679b..e31c38d043 100644
--- a/frontend/rust-lib/collab-integrate/src/collab_builder.rs
+++ b/frontend/rust-lib/collab-integrate/src/collab_builder.rs
@@ -1,6 +1,5 @@
use std::borrow::BorrowMut;
use std::fmt::{Debug, Display};
-use std::str::FromStr;
use std::sync::{Arc, Weak};
use crate::CollabKVDB;
@@ -138,7 +137,6 @@ impl AppFlowyCollabBuilder {
));
}
let device_id = self.workspace_integrate.device_id()?;
- let workspace_id = self.workspace_integrate.workspace_id()?;
Ok(CollabObject::new(
uid,
object_id.to_string(),
@@ -426,13 +424,13 @@ impl CollabPersistence for CollabPersistenceImpl {
.upgrade()
.ok_or_else(|| CollabError::Internal(anyhow!("collab_db is dropped")))?;
- let object_id =
- Uuid::from_str(collab.object_id()).map_err(|v| CollabError::Internal(v.into()))?;
+ let object_id = collab.object_id().to_string();
let rocksdb_read = collab_db.read_txn();
+ let workspace_id = self.workspace_id.to_string();
- if rocksdb_read.is_exist(self.uid, &self.workspace_id, &object_id) {
+ if rocksdb_read.is_exist(self.uid, &workspace_id, &object_id) {
let mut txn = collab.transact_mut();
- match rocksdb_read.load_doc_with_txn(self.uid, &self.workspace_id, &object_id, &mut txn) {
+ match rocksdb_read.load_doc_with_txn(self.uid, &workspace_id, &object_id, &mut txn) {
Ok(update_count) => {
trace!(
"did load collab:{}-{} from disk, update_count:{}",
@@ -457,6 +455,7 @@ impl CollabPersistence for CollabPersistenceImpl {
object_id: &str,
encoded_collab: EncodedCollab,
) -> Result<(), CollabError> {
+ let workspace_id = self.workspace_id.to_string();
let collab_db = self
.db
.upgrade()
@@ -465,7 +464,7 @@ impl CollabPersistence for CollabPersistenceImpl {
write_txn
.flush_doc(
self.uid,
- self.workspace_id.to_string().as_str(),
+ workspace_id.as_str(),
object_id,
encoded_collab.state_vector.to_vec(),
encoded_collab.doc_state.to_vec(),
diff --git a/frontend/rust-lib/event-integration-test/tests/folder/local_test/folder_test.rs b/frontend/rust-lib/event-integration-test/tests/folder/local_test/folder_test.rs
index d0a4a28429..5857190b8b 100644
--- a/frontend/rust-lib/event-integration-test/tests/folder/local_test/folder_test.rs
+++ b/frontend/rust-lib/event-integration-test/tests/folder/local_test/folder_test.rs
@@ -1,8 +1,8 @@
use collab_folder::ViewLayout;
-
use event_integration_test::EventIntegrationTest;
use flowy_folder::entities::icon::{ViewIconPB, ViewIconTypePB};
use flowy_folder::entities::ViewLayoutPB;
+use uuid::Uuid;
use crate::folder::local_test::script::FolderScript::*;
use crate::folder::local_test::script::FolderTest;
@@ -338,11 +338,11 @@ async fn move_view_event_test() {
async fn create_orphan_child_view_and_get_its_ancestors_test() {
let test = EventIntegrationTest::new_anon().await;
let name = "Orphan View";
- let view_id = "20240521";
+ let view_id = Uuid::new_v4().to_string();
test
- .create_orphan_view(name, view_id, ViewLayoutPB::Grid)
+ .create_orphan_view(name, &view_id, ViewLayoutPB::Grid)
.await;
- let ancestors = test.get_view_ancestors(view_id).await;
+ let ancestors = test.get_view_ancestors(&view_id).await;
assert_eq!(ancestors.len(), 1);
assert_eq!(ancestors[0].name, "Orphan View");
assert_eq!(ancestors[0].id, view_id);
diff --git a/frontend/rust-lib/event-integration-test/tests/folder/local_test/publish_document_test.rs b/frontend/rust-lib/event-integration-test/tests/folder/local_test/publish_document_test.rs
index 0d5b9bc08c..089310b260 100644
--- a/frontend/rust-lib/event-integration-test/tests/folder/local_test/publish_document_test.rs
+++ b/frontend/rust-lib/event-integration-test/tests/folder/local_test/publish_document_test.rs
@@ -6,6 +6,7 @@ use flowy_folder::view_operation::GatherEncodedCollab;
use flowy_folder_pub::entities::{
PublishDocumentPayload, PublishPayload, PublishViewInfo, PublishViewMeta, PublishViewMetaData,
};
+use uuid::Uuid;
async fn mock_single_document_view_publish_payload(
test: &EventIntegrationTest,
@@ -140,11 +141,11 @@ async fn create_nested_document(test: &EventIntegrationTest, view_id: &str, name
#[tokio::test]
async fn single_document_get_publish_view_payload_test() {
let test = EventIntegrationTest::new_anon().await;
- let view_id = "20240521";
+ let view_id = Uuid::new_v4().to_string();
let name = "Orphan View";
- create_single_document(&test, view_id, name).await;
- let view = test.get_view(view_id).await;
- let payload = test.get_publish_payload(view_id, true).await;
+ create_single_document(&test, &view_id, name).await;
+ let view = test.get_view(&view_id).await;
+ let payload = test.get_publish_payload(&view_id, true).await;
let expect_payload = mock_single_document_view_publish_payload(
&test,
@@ -160,10 +161,10 @@ async fn single_document_get_publish_view_payload_test() {
async fn nested_document_get_publish_view_payload_test() {
let test = EventIntegrationTest::new_anon().await;
let name = "Orphan View";
- let view_id = "20240521";
- create_nested_document(&test, view_id, name).await;
- let view = test.get_view(view_id).await;
- let payload = test.get_publish_payload(view_id, true).await;
+ let view_id = Uuid::new_v4().to_string();
+ create_nested_document(&test, &view_id, name).await;
+ let view = test.get_view(&view_id).await;
+ let payload = test.get_publish_payload(&view_id, true).await;
let expect_payload = mock_nested_document_view_publish_payload(
&test,
@@ -180,10 +181,10 @@ async fn nested_document_get_publish_view_payload_test() {
async fn no_children_publish_view_payload_test() {
let test = EventIntegrationTest::new_anon().await;
let name = "Orphan View";
- let view_id = "20240521";
- create_nested_document(&test, view_id, name).await;
- let view = test.get_view(view_id).await;
- let payload = test.get_publish_payload(view_id, false).await;
+ let view_id = Uuid::new_v4().to_string();
+ create_nested_document(&test, &view_id, name).await;
+ let view = test.get_view(&view_id).await;
+ let payload = test.get_publish_payload(&view_id, false).await;
let data = mock_single_document_view_publish_payload(
&test,
diff --git a/frontend/rust-lib/event-integration-test/tests/user/migration_test/version_test.rs b/frontend/rust-lib/event-integration-test/tests/user/migration_test/version_test.rs
index 5a75197a9c..61833429aa 100644
--- a/frontend/rust-lib/event-integration-test/tests/user/migration_test/version_test.rs
+++ b/frontend/rust-lib/event-integration-test/tests/user/migration_test/version_test.rs
@@ -1,44 +1,9 @@
use event_integration_test::EventIntegrationTest;
use flowy_core::DEFAULT_NAME;
-use flowy_folder::entities::ViewLayoutPB;
use std::time::Duration;
use crate::util::unzip;
-#[tokio::test]
-async fn migrate_020_historical_empty_document_test() {
- let user_db_path = unzip(
- "./tests/user/migration_test/history_user_db",
- "020_historical_user_data",
- )
- .unwrap();
- let test =
- EventIntegrationTest::new_with_user_data_path(user_db_path, DEFAULT_NAME.to_string()).await;
-
- let mut views = test.get_all_workspace_views().await;
- assert_eq!(views.len(), 1);
-
- // Check the parent view
- let parent_view = views.pop().unwrap();
- assert_eq!(parent_view.layout, ViewLayoutPB::Document);
- let data = test.open_document(parent_view.id.clone()).await.data;
- assert!(!data.page_id.is_empty());
- assert_eq!(data.blocks.len(), 2);
- assert!(!data.meta.children_map.is_empty());
-
- // Check the child views of the parent view
- let child_views = test.get_view(&parent_view.id).await.child_views;
- assert_eq!(child_views.len(), 4);
- assert_eq!(child_views[0].layout, ViewLayoutPB::Document);
- assert_eq!(child_views[1].layout, ViewLayoutPB::Grid);
- assert_eq!(child_views[2].layout, ViewLayoutPB::Calendar);
- assert_eq!(child_views[3].layout, ViewLayoutPB::Board);
-
- let database = test.get_database(&child_views[1].id).await;
- assert_eq!(database.fields.len(), 8);
- assert_eq!(database.rows.len(), 3);
-}
-
#[tokio::test]
async fn migrate_036_fav_v1_workspace_array_test() {
// Used to test migration: FavoriteV1AndWorkspaceArrayMigration
diff --git a/frontend/rust-lib/flowy-document/src/manager.rs b/frontend/rust-lib/flowy-document/src/manager.rs
index 9225b89c03..704dcd0865 100644
--- a/frontend/rust-lib/flowy-document/src/manager.rs
+++ b/frontend/rust-lib/flowy-document/src/manager.rs
@@ -482,7 +482,13 @@ async fn doc_state_from_document_data(
data: Option<DocumentData>,
) -> Result<EncodedCollab, FlowyError> {
let doc_id = doc_id.to_string();
- let data = data.unwrap_or_else(|| default_document_data(&doc_id));
+ let data = data.unwrap_or_else(|| {
+ trace!(
+ "{} document data is None, use default document data",
+ doc_id.to_string()
+ );
+ default_document_data(&doc_id)
+ });
// spawn_blocking is used to avoid blocking the tokio thread pool if the document is large.
let encoded_collab = tokio::task::spawn_blocking(move || {
let collab = Collab::new_with_origin(CollabOrigin::Empty, doc_id, vec![], false);