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: remove legacy CreateRowParams (#6592)

Richard Shiued7bbb4261c45
diff --git a/frontend/rust-lib/flowy-database2/src/entities/row_entities.rs b/frontend/rust-lib/flowy-database2/src/entities/row_entities.rs
index 192145ed48..53030a142f 100644
--- a/frontend/rust-lib/flowy-database2/src/entities/row_entities.rs
+++ b/frontend/rust-lib/flowy-database2/src/entities/row_entities.rs
@@ -480,11 +480,6 @@ pub struct CreateRowPayloadPB {
pub data: HashMap<String, String>,
}
-pub struct CreateRowParams {
- pub collab_params: collab_database::rows::CreateRowParams,
- pub open_after_create: bool,
-}
-
#[derive(Debug, Default, Clone, ProtoBuf)]
pub struct SummaryRowPB {
#[pb(index = 1)]
diff --git a/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs b/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs
index e4809c2ce0..f06fb8fdbf 100644
--- a/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs
+++ b/frontend/rust-lib/flowy-database2/src/services/database/database_editor.rs
@@ -676,14 +676,11 @@ impl DatabaseEditor {
.get_or_init_view_editor(&params.view_id)
.await?;
- let CreateRowParams {
- collab_params,
- open_after_create: _,
- } = view_editor.v_will_create_row(params).await?;
+ let params = view_editor.v_will_create_row(params).await?;
let mut database = self.database.write().await;
let (index, row_order) = database
- .create_row_in_view(&view_editor.view_id, collab_params)
+ .create_row_in_view(&view_editor.view_id, params)
.await?;
let row_detail = database.get_row_detail(&row_order.id).await;
drop(database);
diff --git a/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs b/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs
index d59f65ca3d..c95bd6d30b 100644
--- a/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs
+++ b/frontend/rust-lib/flowy-database2/src/services/database_view/view_editor.rs
@@ -4,11 +4,11 @@ use std::sync::Arc;
use super::notify_did_update_calculation;
use crate::entities::{
- CalendarEventPB, CreateRowParams, CreateRowPayloadPB, DatabaseLayoutMetaPB,
- DatabaseLayoutSettingPB, DeleteSortPayloadPB, FieldSettingsChangesetPB, FieldType,
- GroupChangesPB, GroupPB, InsertedRowPB, LayoutSettingChangeset, LayoutSettingParams,
- RemoveCalculationChangesetPB, ReorderSortPayloadPB, RowMetaPB, RowsChangePB,
- SortChangesetNotificationPB, SortPB, UpdateCalculationChangesetPB, UpdateSortPayloadPB,
+ CalendarEventPB, CreateRowPayloadPB, DatabaseLayoutMetaPB, DatabaseLayoutSettingPB,
+ DeleteSortPayloadPB, FieldSettingsChangesetPB, FieldType, GroupChangesPB, GroupPB, InsertedRowPB,
+ LayoutSettingChangeset, LayoutSettingParams, RemoveCalculationChangesetPB, ReorderSortPayloadPB,
+ RowMetaPB, RowsChangePB, SortChangesetNotificationPB, SortPB, UpdateCalculationChangesetPB,
+ UpdateSortPayloadPB,
};
use crate::notification::{send_notification, DatabaseNotification};
use crate::services::calculations::{
@@ -36,7 +36,7 @@ use crate::services::sort::{Sort, SortChangeset, SortController};
use collab_database::database::{gen_database_calculation_id, gen_database_sort_id, gen_row_id};
use collab_database::entity::DatabaseView;
use collab_database::fields::Field;
-use collab_database::rows::{Cells, Row, RowCell, RowDetail, RowId};
+use collab_database::rows::{Cells, CreateRowParams, Row, RowCell, RowDetail, RowId};
use collab_database::views::{DatabaseLayout, RowOrder};
use dashmap::DashMap;
use flowy_error::{FlowyError, FlowyResult};
@@ -177,17 +177,14 @@ impl DatabaseViewEditor {
let timestamp = timestamp();
trace!("[Database]: will create row at: {:?}", params.row_position);
let mut result = CreateRowParams {
- collab_params: collab_database::rows::CreateRowParams {
- id: gen_row_id(),
- database_id: self.database_id.clone(),
- cells: Cells::new(),
- height: 60,
- visibility: true,
- row_position: params.row_position.try_into()?,
- created_at: timestamp,
- modified_at: timestamp,
- },
- open_after_create: false,
+ id: gen_row_id(),
+ database_id: self.database_id.clone(),
+ cells: Cells::new(),
+ height: 60,
+ visibility: true,
+ row_position: params.row_position.try_into()?,
+ created_at: timestamp,
+ modified_at: timestamp,
};
// fill in cells from the frontend
@@ -210,7 +207,7 @@ impl DatabaseViewEditor {
let filter_controller = self.filter_controller.clone();
filter_controller.fill_cells(&mut cells).await;
- result.collab_params.cells = cells;
+ result.cells = cells;
Ok(result)
}