diff --git a/Cargo.lock b/Cargo.lock index d3718eb7..efc0b00d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2239,7 +2239,7 @@ dependencies = [ [[package]] name = "collab" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3493d8ca30850d1ee84f5ba1f6d7b673614b172e#3493d8ca30850d1ee84f5ba1f6d7b673614b172e" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ded99c0bf6f41089c87de9a718c784c00b8255e5#ded99c0bf6f41089c87de9a718c784c00b8255e5" dependencies = [ "anyhow", "arc-swap", @@ -2264,7 +2264,7 @@ dependencies = [ [[package]] name = "collab-database" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3493d8ca30850d1ee84f5ba1f6d7b673614b172e#3493d8ca30850d1ee84f5ba1f6d7b673614b172e" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ded99c0bf6f41089c87de9a718c784c00b8255e5#ded99c0bf6f41089c87de9a718c784c00b8255e5" dependencies = [ "anyhow", "async-trait", @@ -2303,7 +2303,7 @@ dependencies = [ [[package]] name = "collab-document" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3493d8ca30850d1ee84f5ba1f6d7b673614b172e#3493d8ca30850d1ee84f5ba1f6d7b673614b172e" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ded99c0bf6f41089c87de9a718c784c00b8255e5#ded99c0bf6f41089c87de9a718c784c00b8255e5" dependencies = [ "anyhow", "arc-swap", @@ -2324,7 +2324,7 @@ dependencies = [ [[package]] name = "collab-entity" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3493d8ca30850d1ee84f5ba1f6d7b673614b172e#3493d8ca30850d1ee84f5ba1f6d7b673614b172e" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ded99c0bf6f41089c87de9a718c784c00b8255e5#ded99c0bf6f41089c87de9a718c784c00b8255e5" dependencies = [ "anyhow", "bytes", @@ -2344,7 +2344,7 @@ dependencies = [ [[package]] name = "collab-folder" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3493d8ca30850d1ee84f5ba1f6d7b673614b172e#3493d8ca30850d1ee84f5ba1f6d7b673614b172e" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ded99c0bf6f41089c87de9a718c784c00b8255e5#ded99c0bf6f41089c87de9a718c784c00b8255e5" dependencies = [ "anyhow", "arc-swap", @@ -2366,7 +2366,7 @@ dependencies = [ [[package]] name = "collab-importer" version = "0.1.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3493d8ca30850d1ee84f5ba1f6d7b673614b172e#3493d8ca30850d1ee84f5ba1f6d7b673614b172e" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ded99c0bf6f41089c87de9a718c784c00b8255e5#ded99c0bf6f41089c87de9a718c784c00b8255e5" dependencies = [ "anyhow", "async-recursion", @@ -2469,7 +2469,7 @@ dependencies = [ [[package]] name = "collab-user" version = "0.2.0" -source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=3493d8ca30850d1ee84f5ba1f6d7b673614b172e#3493d8ca30850d1ee84f5ba1f6d7b673614b172e" +source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ded99c0bf6f41089c87de9a718c784c00b8255e5#ded99c0bf6f41089c87de9a718c784c00b8255e5" dependencies = [ "anyhow", "collab", diff --git a/Cargo.toml b/Cargo.toml index c1d7f157..f15dbc05 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -304,13 +304,13 @@ debug = true [patch.crates-io] # It's diffcult to resovle different version with the same crate used in AppFlowy Frontend and the Client-API crate. # So using patch to workaround this issue. -collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3493d8ca30850d1ee84f5ba1f6d7b673614b172e" } -collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3493d8ca30850d1ee84f5ba1f6d7b673614b172e" } -collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3493d8ca30850d1ee84f5ba1f6d7b673614b172e" } -collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3493d8ca30850d1ee84f5ba1f6d7b673614b172e" } -collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3493d8ca30850d1ee84f5ba1f6d7b673614b172e" } -collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3493d8ca30850d1ee84f5ba1f6d7b673614b172e" } -collab-importer = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3493d8ca30850d1ee84f5ba1f6d7b673614b172e" } +collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ded99c0bf6f41089c87de9a718c784c00b8255e5" } +collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ded99c0bf6f41089c87de9a718c784c00b8255e5" } +collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ded99c0bf6f41089c87de9a718c784c00b8255e5" } +collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ded99c0bf6f41089c87de9a718c784c00b8255e5" } +collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ded99c0bf6f41089c87de9a718c784c00b8255e5" } +collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ded99c0bf6f41089c87de9a718c784c00b8255e5" } +collab-importer = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ded99c0bf6f41089c87de9a718c784c00b8255e5" } [features] history = [] diff --git a/libs/client-api-test/src/test_client.rs b/libs/client-api-test/src/test_client.rs index 45b3932f..4149cc9e 100644 --- a/libs/client-api-test/src/test_client.rs +++ b/libs/client-api-test/src/test_client.rs @@ -40,8 +40,8 @@ use database_entity::dto::{ QuerySnapshotParams, SnapshotData, UpdateCollabMemberParams, }; use shared_entity::dto::workspace_dto::{ - BlobMetadata, CollabResponse, WorkspaceMemberChangeset, WorkspaceMemberInvitation, - WorkspaceSpaceUsage, + BlobMetadata, CollabResponse, PublishedDuplicate, WorkspaceMemberChangeset, + WorkspaceMemberInvitation, WorkspaceSpaceUsage, }; use shared_entity::response::AppResponseError; @@ -928,6 +928,28 @@ impl TestClient { .await .unwrap(); } + + pub async fn duplicate_published_to_workspace( + &self, + dest_workspace_id: &str, + src_view_id: &str, + dest_view_id: &str, + ) { + self + .api_client + .duplicate_published_to_workspace( + dest_workspace_id, + &PublishedDuplicate { + published_view_id: src_view_id.to_string(), + dest_view_id: dest_view_id.to_string(), + }, + ) + .await + .unwrap(); + + // wait a while for folder collab to be synced + tokio::time::sleep(Duration::from_secs(1)).await; + } } pub async fn assert_server_snapshot( diff --git a/tests/workspace/publish.rs b/tests/workspace/publish.rs index 3be1f5e2..ce8a3498 100644 --- a/tests/workspace/publish.rs +++ b/tests/workspace/publish.rs @@ -18,7 +18,6 @@ use collab_entity::CollabType; use collab_folder::{CollabOrigin, Folder, UserId}; use itertools::Itertools; use shared_entity::dto::publish_dto::PublishDatabaseData; -use shared_entity::dto::workspace_dto::PublishedDuplicate; use std::collections::{HashMap, HashSet}; use std::thread::sleep; use std::time::Duration; @@ -835,16 +834,12 @@ async fn duplicate_to_workspace_references() { // └── doc1 // └── grid1 client_2 - .api_client .duplicate_published_to_workspace( &workspace_id_2, - &PublishedDuplicate { - published_view_id: doc_2_view_id.to_string(), - dest_view_id: fv.view_id, // use the root view - }, + &doc_2_view_id.to_string(), + &fv.view_id, // use the root view ) - .await - .unwrap(); + .await; let fv = client_2 .api_client @@ -925,16 +920,12 @@ async fn duplicate_to_workspace_doc_inline_database() { // └── grid1 // └── View of grid1 client_2 - .api_client .duplicate_published_to_workspace( &workspace_id_2, - &PublishedDuplicate { - published_view_id: doc_3_view_id.to_string(), - dest_view_id: fv.view_id, // use the root view - }, + &doc_3_view_id.to_string(), + &fv.view_id, // use the root view ) - .await - .unwrap(); + .await; { let fv = client_2 @@ -1087,16 +1078,12 @@ async fn duplicate_to_workspace_db_embedded_in_doc() { // ├── Getting Started (existing) // └── db_with_embedded_db (inside should contain the database) client_2 - .api_client .duplicate_published_to_workspace( &workspace_id_2, - &PublishedDuplicate { - published_view_id: doc_with_embedded_db_view_id.to_string(), - dest_view_id: fv.view_id, // use the root view - }, + &doc_with_embedded_db_view_id.to_string(), + &fv.view_id, // use the root view ) - .await - .unwrap(); + .await; { let fv = client_2 @@ -1192,16 +1179,12 @@ async fn duplicate_to_workspace_db_with_relation() { // related-db cannot be child of db_with_rel_col because they dont share the same field // and are 2 different databases, so we just put them in the root (dest_id) client_2 - .api_client .duplicate_published_to_workspace( &workspace_id_2, - &PublishedDuplicate { - published_view_id: db_with_rel_col_view_id.to_string(), - dest_view_id: fv.view_id, // use the root view - }, + &db_with_rel_col_view_id.to_string(), + &fv.view_id, // use the root view ) - .await - .unwrap(); + .await; { let fv = client_2 @@ -1281,16 +1264,12 @@ async fn duplicate_to_workspace_db_row_with_doc() { // ├── Getting Started (existing) // └── db_with_row_doc client_2 - .api_client .duplicate_published_to_workspace( &workspace_id_2, - &PublishedDuplicate { - published_view_id: db_with_row_doc_view_id.to_string(), - dest_view_id: fv.view_id, // use the root view - }, + &db_with_row_doc_view_id.to_string(), + &fv.view_id, // use the root view ) - .await - .unwrap(); + .await; { let fv = client_2 @@ -1364,16 +1343,12 @@ async fn duplicate_to_workspace_db_rel_self() { .unwrap(); client_2 - .api_client .duplicate_published_to_workspace( &workspace_id_2, - &PublishedDuplicate { - published_view_id: db_rel_self_view_id.to_string(), - dest_view_id: fv.view_id, // use the root view - }, + &db_rel_self_view_id.to_string(), + &fv.view_id, // use the root view ) - .await - .unwrap(); + .await; let fv = client_2 .api_client @@ -1459,16 +1434,12 @@ async fn duplicate_to_workspace_inline_db_doc_with_relation() { .unwrap(); client_2 - .api_client .duplicate_published_to_workspace( &workspace_id_2, - &PublishedDuplicate { - published_view_id: doc_4_view_id.to_string(), - dest_view_id: fv.view_id, // use the root view - }, + &doc_4_view_id.to_string(), + &fv.view_id, // use the root view ) - .await - .unwrap(); + .await; let fv = client_2 .api_client