Skip to content

Commit

Permalink
chore: bump appflowy collab (#805)
Browse files Browse the repository at this point in the history
* chore: bump appflowy collab

* chore: fix test

* chore: bump collab
  • Loading branch information
appflowy authored Sep 9, 2024
1 parent 135071e commit 3f59c65
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 31 deletions.
34 changes: 28 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,12 @@ 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 = "47dbd6c8033f8fd2999cb8d11f2d60ede121a0ac" }
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "47dbd6c8033f8fd2999cb8d11f2d60ede121a0ac" }
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "47dbd6c8033f8fd2999cb8d11f2d60ede121a0ac" }
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "47dbd6c8033f8fd2999cb8d11f2d60ede121a0ac" }
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "47dbd6c8033f8fd2999cb8d11f2d60ede121a0ac" }
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "47dbd6c8033f8fd2999cb8d11f2d60ede121a0ac" }
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5f3e7163e3a408a08423d079eb41068fb86e562b" }

[features]
history = []
Expand Down
2 changes: 1 addition & 1 deletion libs/client-api-test/src/test_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ impl TestClient {
)
.unwrap();

UserAwareness::open(collab, None)
UserAwareness::open(collab, None).unwrap()
}

pub async fn try_update_workspace_member(
Expand Down
4 changes: 2 additions & 2 deletions libs/workspace-template/src/document/getting_started.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl GettingStartedTemplate {
// 2. create a new document with the getting started data
let data = tokio::task::spawn_blocking(move || {
let collab = Collab::new_with_origin(CollabOrigin::Empty, &object_id, vec![], false);
let document = Document::open_with(collab, Some(document_data))?;
let document = Document::create_with_data(collab, document_data)?;
let encoded_collab = document.encode_collab()?;

Ok::<_, anyhow::Error>(TemplateData {
Expand Down Expand Up @@ -366,7 +366,7 @@ impl WorkspaceTemplate for DocumentTemplate {

async fn create(&self, object_id: String) -> anyhow::Result<Vec<TemplateData>> {
let collab = Collab::new_with_origin(CollabOrigin::Empty, &object_id, vec![], false);
let document = Document::open_with(collab, Some(self.0.clone()))?;
let document = Document::create_with_data(collab, self.0.clone())?;
let data = document.encode_collab()?;
Ok(vec![TemplateData {
template_id: TemplateObjectId::Document(object_id),
Expand Down
2 changes: 1 addition & 1 deletion libs/workspace-template/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl WorkspaceTemplateBuilder {
};

let collab = Collab::new_with_origin(CollabOrigin::Empty, &workspace_id, vec![], false);
let folder = Folder::open_with(uid, collab, None, Some(folder_data));
let folder = Folder::create(uid, collab, None, folder_data);
let data = folder.encode_collab()?;
Ok::<_, anyhow::Error>(TemplateData {
template_id: TemplateObjectId::Folder(workspace_id),
Expand Down
2 changes: 1 addition & 1 deletion src/biz/user/user_init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ async fn create_user_awareness(
let collab = Collab::new_with_origin(CollabOrigin::Empty, object_id.clone(), vec![], false);

// TODO(nathan): Maybe using hardcode encoded collab
let user_awareness = UserAwareness::open(collab, None);
let user_awareness = UserAwareness::create(collab, None)?;
let encode_collab = user_awareness
.encode_collab_v1(|collab| collab_type.validate_require_data(collab))
.map_err(AppError::Internal)?;
Expand Down
6 changes: 3 additions & 3 deletions src/biz/workspace/publish_dup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use collab::core::collab::DataSource;
use collab::preclude::Collab;

use collab::preclude::MapExt;
use collab_database::views::ViewMap;
use collab_database::views::DatabaseViews;
use collab_database::workspace_database::WorkspaceDatabaseBody;
use collab_document::blocks::DocumentData;
use collab_document::document::Document;
Expand Down Expand Up @@ -389,7 +389,7 @@ impl PublishCollabDuplicator {
// write modified doc_data back to storage
let empty_collab = collab_from_doc_state(vec![], &new_view_id)?;
let new_doc = tokio::task::spawn_blocking(move || {
Document::open_with(empty_collab, Some(doc_data))
Document::create_with_data(empty_collab, doc_data)
.map_err(|e| AppError::Unhandled(e.to_string()))
})
.await??;
Expand Down Expand Up @@ -720,7 +720,7 @@ impl PublishCollabDuplicator {
.data
.get_with_path(&txn, ["database", "views"])
.ok_or_else(|| AppError::RecordNotFound("no views found in database".to_string()))?;
ViewMap::new(map_ref, tokio::sync::broadcast::channel(1).0)
DatabaseViews::new(CollabOrigin::Empty, map_ref, None)
};

// create new database views based on published views
Expand Down
2 changes: 1 addition & 1 deletion tests/search/document_search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async fn test_document_indexing_and_search() {
vec![],
false,
);
let document = Document::open_with(collab, Some(document_data)).unwrap();
let document = Document::create_with_data(collab, document_data).unwrap();
document.encode_collab().unwrap()
};
test_client
Expand Down
19 changes: 9 additions & 10 deletions tests/workspace/publish.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
use app_error::ErrorCode;
use appflowy_cloud::biz::collab::folder_view::collab_folder_to_folder_view;
use appflowy_cloud::biz::workspace::publish_dup::{
collab_from_doc_state, get_database_id_from_collab,
};
use client_api::entity::{
AFRole, GlobalComment, PublishCollabItem, PublishCollabMetadata, QueryCollab, QueryCollabParams,
};
use client_api_test::TestClient;
use client_api_test::{generate_unique_registered_user_client, localhost_client};
use collab::util::MapExt;
use collab_database::views::ViewMap;
use collab_database::views::DatabaseViews;
use collab_database::workspace_database::WorkspaceDatabaseBody;
use collab_document::document::Document;
use collab_entity::CollabType;
use collab_folder::{CollabOrigin, Folder};
use itertools::Itertools;
use shared_entity::dto::publish_dto::PublishDatabaseData;
use shared_entity::dto::publish_dto::PublishViewMetaData;
use shared_entity::dto::workspace_dto::PublishedDuplicate;
use std::collections::{HashMap, HashSet};
use std::thread::sleep;
use std::time::Duration;

use app_error::ErrorCode;
use client_api::entity::{
AFRole, GlobalComment, PublishCollabItem, PublishCollabMetadata, QueryCollab, QueryCollabParams,
};
use client_api_test::TestClient;
use client_api_test::{generate_unique_registered_user_client, localhost_client};
use itertools::Itertools;

use crate::workspace::published_data::{self};

#[tokio::test]
Expand Down Expand Up @@ -969,7 +968,7 @@ async fn duplicate_to_workspace_doc_inline_database() {
.data
.get_with_path(&txn, ["database", "views"])
.unwrap();
ViewMap::new(map_ref, tokio::sync::broadcast::channel(1).0)
DatabaseViews::new(CollabOrigin::Empty, map_ref, None)
};

for db_view in view_map.get_all_views(&txn) {
Expand Down

0 comments on commit 3f59c65

Please sign in to comment.