mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: bump up collab version (#2736)
This commit is contained in:
@ -34,12 +34,12 @@ default = ["custom-protocol"]
|
|||||||
custom-protocol = ["tauri/custom-protocol"]
|
custom-protocol = ["tauri/custom-protocol"]
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c611b6" }
|
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "046a91" }
|
||||||
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c611b6" }
|
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "046a91" }
|
||||||
collab-persistence = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c611b6" }
|
collab-persistence = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "046a91" }
|
||||||
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c611b6" }
|
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "046a91" }
|
||||||
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c611b6" }
|
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "046a91" }
|
||||||
appflowy-integrate = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c611b6" }
|
appflowy-integrate = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "046a91" }
|
||||||
|
|
||||||
#collab = { path = "../../AppFlowy-Collab/collab" }
|
#collab = { path = "../../AppFlowy-Collab/collab" }
|
||||||
#collab-folder = { path = "../../AppFlowy-Collab/collab-folder" }
|
#collab-folder = { path = "../../AppFlowy-Collab/collab-folder" }
|
||||||
|
20
frontend/rust-lib/Cargo.lock
generated
20
frontend/rust-lib/Cargo.lock
generated
@ -85,7 +85,7 @@ checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "appflowy-integrate"
|
name = "appflowy-integrate"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c611b6#c611b6639ba089f7a24705ccb5904ed1b33be538"
|
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=046a91#046a916cc357f4b6c88f4f5a66a84ca0e14c3c62"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"collab",
|
"collab",
|
||||||
@ -887,7 +887,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "collab"
|
name = "collab"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c611b6#c611b6639ba089f7a24705ccb5904ed1b33be538"
|
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=046a91#046a916cc357f4b6c88f4f5a66a84ca0e14c3c62"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"bytes",
|
"bytes",
|
||||||
@ -905,7 +905,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "collab-client-ws"
|
name = "collab-client-ws"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c611b6#c611b6639ba089f7a24705ccb5904ed1b33be538"
|
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=046a91#046a916cc357f4b6c88f4f5a66a84ca0e14c3c62"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"collab-sync",
|
"collab-sync",
|
||||||
@ -923,7 +923,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "collab-database"
|
name = "collab-database"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c611b6#c611b6639ba089f7a24705ccb5904ed1b33be538"
|
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=046a91#046a916cc357f4b6c88f4f5a66a84ca0e14c3c62"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@ -949,7 +949,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "collab-derive"
|
name = "collab-derive"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c611b6#c611b6639ba089f7a24705ccb5904ed1b33be538"
|
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=046a91#046a916cc357f4b6c88f4f5a66a84ca0e14c3c62"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -961,7 +961,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "collab-document"
|
name = "collab-document"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c611b6#c611b6639ba089f7a24705ccb5904ed1b33be538"
|
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=046a91#046a916cc357f4b6c88f4f5a66a84ca0e14c3c62"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"collab",
|
"collab",
|
||||||
@ -978,7 +978,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "collab-folder"
|
name = "collab-folder"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c611b6#c611b6639ba089f7a24705ccb5904ed1b33be538"
|
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=046a91#046a916cc357f4b6c88f4f5a66a84ca0e14c3c62"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"collab",
|
"collab",
|
||||||
@ -997,7 +997,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "collab-persistence"
|
name = "collab-persistence"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c611b6#c611b6639ba089f7a24705ccb5904ed1b33be538"
|
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=046a91#046a916cc357f4b6c88f4f5a66a84ca0e14c3c62"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"chrono",
|
"chrono",
|
||||||
@ -1017,7 +1017,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "collab-plugins"
|
name = "collab-plugins"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c611b6#c611b6639ba089f7a24705ccb5904ed1b33be538"
|
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=046a91#046a916cc357f4b6c88f4f5a66a84ca0e14c3c62"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
@ -1048,7 +1048,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "collab-sync"
|
name = "collab-sync"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=c611b6#c611b6639ba089f7a24705ccb5904ed1b33be538"
|
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Collab?rev=046a91#046a916cc357f4b6c88f4f5a66a84ca0e14c3c62"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"collab",
|
"collab",
|
||||||
|
@ -33,11 +33,11 @@ opt-level = 3
|
|||||||
incremental = false
|
incremental = false
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c611b6" }
|
collab = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "046a91" }
|
||||||
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c611b6" }
|
collab-folder = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "046a91" }
|
||||||
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c611b6" }
|
collab-document = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "046a91" }
|
||||||
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c611b6" }
|
collab-database = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "046a91" }
|
||||||
appflowy-integrate = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "c611b6" }
|
appflowy-integrate = { git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "046a91" }
|
||||||
|
|
||||||
#collab = { path = "../AppFlowy-Collab/collab" }
|
#collab = { path = "../AppFlowy-Collab/collab" }
|
||||||
#collab-folder = { path = "../AppFlowy-Collab/collab-folder" }
|
#collab-folder = { path = "../AppFlowy-Collab/collab-folder" }
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use appflowy_integrate::{
|
use appflowy_integrate::{
|
||||||
calculate_snapshot_diff, try_encode_snapshot, CollabSnapshot, MutexCollab, PersistenceError,
|
calculate_snapshot_diff, CollabSnapshot, PersistenceError, SnapshotPersistence,
|
||||||
Snapshot, SnapshotDB,
|
|
||||||
};
|
};
|
||||||
use diesel::SqliteConnection;
|
use diesel::SqliteConnection;
|
||||||
|
|
||||||
@ -17,7 +16,7 @@ use lib_infra::util::timestamp;
|
|||||||
|
|
||||||
pub struct SnapshotDBImpl(pub Arc<UserSession>);
|
pub struct SnapshotDBImpl(pub Arc<UserSession>);
|
||||||
|
|
||||||
impl SnapshotDB for SnapshotDBImpl {
|
impl SnapshotPersistence for SnapshotDBImpl {
|
||||||
fn get_snapshots(&self, _uid: i64, object_id: &str) -> Vec<CollabSnapshot> {
|
fn get_snapshots(&self, _uid: i64, object_id: &str) -> Vec<CollabSnapshot> {
|
||||||
self
|
self
|
||||||
.0
|
.0
|
||||||
@ -36,8 +35,7 @@ impl SnapshotDB for SnapshotDBImpl {
|
|||||||
object_id: &str,
|
object_id: &str,
|
||||||
title: String,
|
title: String,
|
||||||
collab_type: String,
|
collab_type: String,
|
||||||
snapshot: Snapshot,
|
snapshot_data: Vec<u8>,
|
||||||
collab: Arc<MutexCollab>,
|
|
||||||
) -> Result<(), PersistenceError> {
|
) -> Result<(), PersistenceError> {
|
||||||
let object_id = object_id.to_string();
|
let object_id = object_id.to_string();
|
||||||
let weak_pool = Arc::downgrade(
|
let weak_pool = Arc::downgrade(
|
||||||
@ -53,41 +51,31 @@ impl SnapshotDB for SnapshotDBImpl {
|
|||||||
.get()
|
.get()
|
||||||
.map_err(|e| PersistenceError::Internal(Box::new(e)))?;
|
.map_err(|e| PersistenceError::Internal(Box::new(e)))?;
|
||||||
|
|
||||||
// Try to acquire a txn lock, if failed, it means there is a txn running, so we just ignore this snapshot
|
let desc = match CollabSnapshotTableSql::get_latest_snapshot(&object_id, &conn) {
|
||||||
let result = try_encode_snapshot(
|
None => Ok("".to_string()),
|
||||||
&collab
|
Some(old_snapshot) => {
|
||||||
.lock()
|
calculate_snapshot_diff(uid, &object_id, &old_snapshot.data, &snapshot_data)
|
||||||
.try_transaction()
|
},
|
||||||
.map_err(|e| PersistenceError::Internal(Box::new(e)))?,
|
}
|
||||||
snapshot,
|
.map_err(|e| PersistenceError::InvalidData(format!("{:?}", e)))?;
|
||||||
);
|
|
||||||
|
|
||||||
match result.and_then(|new_snapshot_data| {
|
// Save the snapshot data to disk
|
||||||
let desc = match CollabSnapshotTableSql::get_latest_snapshot(&object_id, &conn) {
|
let result = CollabSnapshotTableSql::create(
|
||||||
None => Ok("".to_string()),
|
CollabSnapshotRow {
|
||||||
Some(old_snapshot) => {
|
id: uuid::Uuid::new_v4().to_string(),
|
||||||
calculate_snapshot_diff(uid, &object_id, &old_snapshot.data, &new_snapshot_data)
|
object_id: object_id.clone(),
|
||||||
},
|
title,
|
||||||
}
|
desc,
|
||||||
.map_err(|e| PersistenceError::InvalidData(format!("{:?}", e)))?;
|
collab_type,
|
||||||
|
timestamp: timestamp(),
|
||||||
|
data: snapshot_data,
|
||||||
|
},
|
||||||
|
&conn,
|
||||||
|
)
|
||||||
|
.map_err(|e| PersistenceError::Internal(Box::new(e)));
|
||||||
|
|
||||||
// Save the snapshot to disk
|
if let Err(e) = result {
|
||||||
CollabSnapshotTableSql::create(
|
tracing::error!("create snapshot error: {:?}", e);
|
||||||
CollabSnapshotRow {
|
|
||||||
id: uuid::Uuid::new_v4().to_string(),
|
|
||||||
object_id: object_id.clone(),
|
|
||||||
title,
|
|
||||||
desc,
|
|
||||||
collab_type,
|
|
||||||
timestamp: timestamp(),
|
|
||||||
data: new_snapshot_data,
|
|
||||||
},
|
|
||||||
&conn,
|
|
||||||
)
|
|
||||||
.map_err(|e| PersistenceError::Internal(Box::new(e)))
|
|
||||||
}) {
|
|
||||||
Ok(_) => {},
|
|
||||||
Err(e) => tracing::error!("create snapshot error: {:?}", e),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok::<(), PersistenceError>(())
|
Ok::<(), PersistenceError>(())
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
use std::cmp::Ordering;
|
||||||
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
use collab::core::any_map::AnyMapExtension;
|
||||||
|
use collab_database::fields::{Field, TypeOptionData, TypeOptionDataBuilder};
|
||||||
|
use collab_database::rows::Cell;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use flowy_error::FlowyResult;
|
||||||
|
|
||||||
use crate::entities::{CheckboxFilterPB, FieldType};
|
use crate::entities::{CheckboxFilterPB, FieldType};
|
||||||
use crate::services::cell::{CellDataChangeset, CellDataDecoder};
|
use crate::services::cell::{CellDataChangeset, CellDataDecoder};
|
||||||
use crate::services::field::{
|
use crate::services::field::{
|
||||||
@ -5,14 +15,6 @@ use crate::services::field::{
|
|||||||
TypeOptionCellDataFilter, TypeOptionTransform,
|
TypeOptionCellDataFilter, TypeOptionTransform,
|
||||||
};
|
};
|
||||||
|
|
||||||
use collab::core::any_map::AnyMapExtension;
|
|
||||||
use collab_database::fields::{Field, TypeOptionData, TypeOptionDataBuilder};
|
|
||||||
use collab_database::rows::Cell;
|
|
||||||
use flowy_error::FlowyResult;
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use std::cmp::Ordering;
|
|
||||||
use std::str::FromStr;
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||||
pub struct CheckboxTypeOption {
|
pub struct CheckboxTypeOption {
|
||||||
pub is_selected: bool,
|
pub is_selected: bool,
|
||||||
@ -89,10 +91,7 @@ impl CellDataDecoder for CheckboxTypeOption {
|
|||||||
if !decoded_field_type.is_checkbox() {
|
if !decoded_field_type.is_checkbox() {
|
||||||
return Ok(Default::default());
|
return Ok(Default::default());
|
||||||
}
|
}
|
||||||
|
self.parse_cell(cell)
|
||||||
let cell = self.parse_cell(cell);
|
|
||||||
println!("cell: {:?}", cell);
|
|
||||||
return cell;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn stringify_cell_data(&self, cell_data: <Self as TypeOption>::CellData) -> String {
|
fn stringify_cell_data(&self, cell_data: <Self as TypeOption>::CellData) -> String {
|
||||||
|
@ -42,7 +42,7 @@ pub(crate) async fn open_workspace_handler(
|
|||||||
None => Err(FlowyError::workspace_id().context("workspace id should not be empty")),
|
None => Err(FlowyError::workspace_id().context("workspace id should not be empty")),
|
||||||
Some(workspace_id) => {
|
Some(workspace_id) => {
|
||||||
if workspace_id.is_empty() {
|
if workspace_id.is_empty() {
|
||||||
return Err(FlowyError::workspace_id().context("workspace id should not be empty"));
|
Err(FlowyError::workspace_id().context("workspace id should not be empty"))
|
||||||
} else {
|
} else {
|
||||||
let workspace = folder.open_workspace(&workspace_id).await?;
|
let workspace = folder.open_workspace(&workspace_id).await?;
|
||||||
let views = folder.get_workspace_views(&workspace_id).await?;
|
let views = folder.get_workspace_views(&workspace_id).await?;
|
||||||
|
@ -66,7 +66,7 @@ impl Folder2Manager {
|
|||||||
self.with_folder(Err(FlowyError::internal()), |folder| {
|
self.with_folder(Err(FlowyError::internal()), |folder| {
|
||||||
let workspace_pb_from_workspace = |workspace: Workspace, folder: &Folder| {
|
let workspace_pb_from_workspace = |workspace: Workspace, folder: &Folder| {
|
||||||
let views = get_workspace_view_pbs(&workspace.id, folder);
|
let views = get_workspace_view_pbs(&workspace.id, folder);
|
||||||
let workspace: WorkspacePB = (workspace.clone(), views).into();
|
let workspace: WorkspacePB = (workspace, views).into();
|
||||||
Ok::<WorkspacePB, FlowyError>(workspace)
|
Ok::<WorkspacePB, FlowyError>(workspace)
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -317,12 +317,6 @@ impl Folder2Manager {
|
|||||||
created_at: timestamp(),
|
created_at: timestamp(),
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
if let Some(view) = folder.get_current_view() {
|
|
||||||
if view == view_id {
|
|
||||||
folder.set_current_view("");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// notify the parent view that the view is moved to trash
|
// notify the parent view that the view is moved to trash
|
||||||
send_notification(view_id, FolderNotification::DidMoveViewToTrash)
|
send_notification(view_id, FolderNotification::DidMoveViewToTrash)
|
||||||
.payload(DeletedViewPB {
|
.payload(DeletedViewPB {
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
|
use std::convert::TryFrom;
|
||||||
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
|
|
||||||
use flowy_database2::entities::{
|
use flowy_database2::entities::{
|
||||||
CellChangesetPB, DatabaseLayoutPB, DatabaseViewIdPB, FieldType, SelectOptionCellDataPB,
|
CellChangesetPB, DatabaseLayoutPB, DatabaseViewIdPB, FieldType, SelectOptionCellDataPB,
|
||||||
};
|
};
|
||||||
use flowy_test::event_builder::EventBuilder;
|
use flowy_test::event_builder::EventBuilder;
|
||||||
use flowy_test::FlowyCoreTest;
|
use flowy_test::FlowyCoreTest;
|
||||||
use std::convert::TryFrom;
|
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn get_database_id_event_test() {
|
async fn get_database_id_event_test() {
|
||||||
@ -248,7 +250,7 @@ async fn update_checkbox_cell_event_test() {
|
|||||||
let field_id = fields[2].id.clone();
|
let field_id = fields[2].id.clone();
|
||||||
assert_eq!(fields[2].field_type, FieldType::Checkbox);
|
assert_eq!(fields[2].field_type, FieldType::Checkbox);
|
||||||
|
|
||||||
for input in vec!["yes", "true", "1"] {
|
for input in &["yes", "true", "1"] {
|
||||||
let error = test
|
let error = test
|
||||||
.update_cell(CellChangesetPB {
|
.update_cell(CellChangesetPB {
|
||||||
view_id: grid_view.id.clone(),
|
view_id: grid_view.id.clone(),
|
||||||
|
Reference in New Issue
Block a user