Merge branch 'main' into feat/workspace-invite-fields

This commit is contained in:
Zack Fu Zi Xiang 2024-09-15 13:59:25 +08:00
commit 35786fb2d5
No known key found for this signature in database
8 changed files with 31 additions and 22 deletions

13
Cargo.lock generated
View File

@ -2092,7 +2092,7 @@ dependencies = [
[[package]]
name = "collab"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=71c5bd32ddb72252e8f8eddfd4f5ce75ecd31354#71c5bd32ddb72252e8f8eddfd4f5ce75ecd31354"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ca26f6f4d205834ce1eb7291003d6f869ef66dc6#ca26f6f4d205834ce1eb7291003d6f869ef66dc6"
dependencies = [
"anyhow",
"arc-swap",
@ -2117,7 +2117,7 @@ dependencies = [
[[package]]
name = "collab-database"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=71c5bd32ddb72252e8f8eddfd4f5ce75ecd31354#71c5bd32ddb72252e8f8eddfd4f5ce75ecd31354"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ca26f6f4d205834ce1eb7291003d6f869ef66dc6#ca26f6f4d205834ce1eb7291003d6f869ef66dc6"
dependencies = [
"anyhow",
"async-trait",
@ -2147,7 +2147,7 @@ dependencies = [
[[package]]
name = "collab-document"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=71c5bd32ddb72252e8f8eddfd4f5ce75ecd31354#71c5bd32ddb72252e8f8eddfd4f5ce75ecd31354"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ca26f6f4d205834ce1eb7291003d6f869ef66dc6#ca26f6f4d205834ce1eb7291003d6f869ef66dc6"
dependencies = [
"anyhow",
"arc-swap",
@ -2167,7 +2167,7 @@ dependencies = [
[[package]]
name = "collab-entity"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=71c5bd32ddb72252e8f8eddfd4f5ce75ecd31354#71c5bd32ddb72252e8f8eddfd4f5ce75ecd31354"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ca26f6f4d205834ce1eb7291003d6f869ef66dc6#ca26f6f4d205834ce1eb7291003d6f869ef66dc6"
dependencies = [
"anyhow",
"bytes",
@ -2179,6 +2179,7 @@ dependencies = [
"serde",
"serde_json",
"serde_repr",
"thiserror",
"uuid",
"walkdir",
]
@ -2186,7 +2187,7 @@ dependencies = [
[[package]]
name = "collab-folder"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=71c5bd32ddb72252e8f8eddfd4f5ce75ecd31354#71c5bd32ddb72252e8f8eddfd4f5ce75ecd31354"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ca26f6f4d205834ce1eb7291003d6f869ef66dc6#ca26f6f4d205834ce1eb7291003d6f869ef66dc6"
dependencies = [
"anyhow",
"arc-swap",
@ -2271,7 +2272,7 @@ dependencies = [
[[package]]
name = "collab-user"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=71c5bd32ddb72252e8f8eddfd4f5ce75ecd31354#71c5bd32ddb72252e8f8eddfd4f5ce75ecd31354"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=ca26f6f4d205834ce1eb7291003d6f869ef66dc6#ca26f6f4d205834ce1eb7291003d6f869ef66dc6"
dependencies = [
"anyhow",
"collab",

View File

@ -288,12 +288,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 = "71c5bd32ddb72252e8f8eddfd4f5ce75ecd31354" }
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "71c5bd32ddb72252e8f8eddfd4f5ce75ecd31354" }
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "71c5bd32ddb72252e8f8eddfd4f5ce75ecd31354" }
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "71c5bd32ddb72252e8f8eddfd4f5ce75ecd31354" }
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "71c5bd32ddb72252e8f8eddfd4f5ce75ecd31354" }
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "71c5bd32ddb72252e8f8eddfd4f5ce75ecd31354" }
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ca26f6f4d205834ce1eb7291003d6f869ef66dc6" }
collab-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ca26f6f4d205834ce1eb7291003d6f869ef66dc6" }
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ca26f6f4d205834ce1eb7291003d6f869ef66dc6" }
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ca26f6f4d205834ce1eb7291003d6f869ef66dc6" }
collab-user = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ca26f6f4d205834ce1eb7291003d6f869ef66dc6" }
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "ca26f6f4d205834ce1eb7291003d6f869ef66dc6" }
[features]
history = []

View File

@ -191,7 +191,7 @@ where
Sink: SinkExt<Vec<ClientCollabMessage>, Error = E> + Send + Sync + Unpin + 'static,
{
if let Err(err) = sync_object.collab_type.validate_require_data(collab) {
return Err(SyncError::Internal(err));
return Err(SyncError::Internal(err.into()));
}
match reason {

View File

@ -3,7 +3,7 @@
# Generate the current dependency list
cargo tree > current_deps.txt
BASELINE_COUNT=619
BASELINE_COUNT=620
CURRENT_COUNT=$(cat current_deps.txt | wc -l)
echo "Expected dependency count (baseline): $BASELINE_COUNT"

View File

@ -120,8 +120,12 @@ impl CollabGroup {
pub async fn encode_collab(&self) -> Result<EncodedCollab, RealtimeError> {
let lock = self.collab.read().await;
let encode_collab =
lock.encode_collab_v1(|collab| self.collab_type.validate_require_data(collab))?;
let encode_collab = lock.encode_collab_v1(|collab| {
self
.collab_type
.validate_require_data(collab)
.map_err(|err| RealtimeError::Internal(err.into()))
})?;
Ok(encode_collab)
}

View File

@ -74,8 +74,12 @@ impl OpenCollabHandle {
pub async fn history_state(&self) -> Result<HistoryStatePb, HistoryError> {
let lock_guard = self.collab.read().await;
let encode_collab =
lock_guard.encode_collab_v1(|collab| self.collab_type.validate_require_data(collab))?;
let encode_collab = lock_guard.encode_collab_v1(|collab| {
self
.collab_type
.validate_require_data(collab)
.map_err(|err| HistoryError::Internal(err.into()))
})?;
Ok(HistoryStatePb {
object_id: self.object_id.clone(),
doc_state: encode_collab.doc_state.to_vec(),

View File

@ -196,8 +196,8 @@ pub fn workspace_scope() -> Scope {
)
.service(
web::resource("/{workspace_id}/collab_list")
.route(web::get().to(batch_get_collab_handler)) // deprecated: browser cannot use json param
// for GET request
.route(web::get().to(batch_get_collab_handler))
// Web browser can't carry payload when using GET method, so for browser compatibility, we use POST method
.route(web::post().to(batch_get_collab_handler)),
)
}

View File

@ -126,7 +126,7 @@ async fn create_user_awareness(
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)?;
.map_err(|err| AppError::Internal(err.into()))?;
let encoded_collab_v1 = encode_collab
.encode_to_bytes()
.map_err(|err| AppError::Internal(anyhow::Error::from(err)))?;
@ -167,7 +167,7 @@ async fn create_workspace_database_collab(
let encode_collab = collab
.encode_collab_v1(|collab| collab_type.validate_require_data(collab))
.map_err(AppError::Internal)?;
.map_err(|err| AppError::Internal(err.into()))?;
let encoded_collab_v1 = encode_collab
.encode_to_bytes()