chore: fix remove view desc test (#6696)

* chore: fix remove view desc test

* chore: fix remove view desc test

* chore: clippy
This commit is contained in:
Nathan.fooo 2024-11-01 15:57:58 +08:00 committed by GitHub
parent 4d33c87b33
commit 690b46a59a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 36 additions and 90 deletions

View File

@ -25,7 +25,7 @@ env:
jobs:
self-hosted-job:
if: github.event.pull_request.head.repo.full_name != github.repository
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: self-hosted
steps:
- name: Checkout source code

View File

@ -172,7 +172,7 @@ checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
[[package]]
name = "app-error"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=648c977c0752609a00ccdfdc5cc8141789e63c4a#648c977c0752609a00ccdfdc5cc8141789e63c4a"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4643e568d2d9b725b0d06dfbbf351317cf9a2c9f#4643e568d2d9b725b0d06dfbbf351317cf9a2c9f"
dependencies = [
"anyhow",
"bincode",
@ -192,7 +192,7 @@ dependencies = [
[[package]]
name = "appflowy-ai-client"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=648c977c0752609a00ccdfdc5cc8141789e63c4a#648c977c0752609a00ccdfdc5cc8141789e63c4a"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4643e568d2d9b725b0d06dfbbf351317cf9a2c9f#4643e568d2d9b725b0d06dfbbf351317cf9a2c9f"
dependencies = [
"anyhow",
"bytes",
@ -888,7 +888,7 @@ dependencies = [
[[package]]
name = "client-api"
version = "0.2.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=648c977c0752609a00ccdfdc5cc8141789e63c4a#648c977c0752609a00ccdfdc5cc8141789e63c4a"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4643e568d2d9b725b0d06dfbbf351317cf9a2c9f#4643e568d2d9b725b0d06dfbbf351317cf9a2c9f"
dependencies = [
"again",
"anyhow",
@ -943,7 +943,7 @@ dependencies = [
[[package]]
name = "client-api-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=648c977c0752609a00ccdfdc5cc8141789e63c4a#648c977c0752609a00ccdfdc5cc8141789e63c4a"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4643e568d2d9b725b0d06dfbbf351317cf9a2c9f#4643e568d2d9b725b0d06dfbbf351317cf9a2c9f"
dependencies = [
"collab-entity",
"collab-rt-entity",
@ -956,7 +956,7 @@ dependencies = [
[[package]]
name = "client-websocket"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=648c977c0752609a00ccdfdc5cc8141789e63c4a#648c977c0752609a00ccdfdc5cc8141789e63c4a"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4643e568d2d9b725b0d06dfbbf351317cf9a2c9f#4643e568d2d9b725b0d06dfbbf351317cf9a2c9f"
dependencies = [
"futures-channel",
"futures-util",
@ -1256,7 +1256,7 @@ dependencies = [
[[package]]
name = "collab-rt-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=648c977c0752609a00ccdfdc5cc8141789e63c4a#648c977c0752609a00ccdfdc5cc8141789e63c4a"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4643e568d2d9b725b0d06dfbbf351317cf9a2c9f#4643e568d2d9b725b0d06dfbbf351317cf9a2c9f"
dependencies = [
"anyhow",
"bincode",
@ -1281,7 +1281,7 @@ dependencies = [
[[package]]
name = "collab-rt-protocol"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=648c977c0752609a00ccdfdc5cc8141789e63c4a#648c977c0752609a00ccdfdc5cc8141789e63c4a"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4643e568d2d9b725b0d06dfbbf351317cf9a2c9f#4643e568d2d9b725b0d06dfbbf351317cf9a2c9f"
dependencies = [
"anyhow",
"async-trait",
@ -1678,7 +1678,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
[[package]]
name = "database-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=648c977c0752609a00ccdfdc5cc8141789e63c4a#648c977c0752609a00ccdfdc5cc8141789e63c4a"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4643e568d2d9b725b0d06dfbbf351317cf9a2c9f#4643e568d2d9b725b0d06dfbbf351317cf9a2c9f"
dependencies = [
"anyhow",
"app-error",
@ -2476,6 +2476,7 @@ dependencies = [
"async-trait",
"bytes",
"chrono",
"client-api",
"collab",
"collab-document",
"collab-entity",
@ -2512,6 +2513,7 @@ name = "flowy-folder-pub"
version = "0.1.0"
dependencies = [
"anyhow",
"client-api",
"collab",
"collab-entity",
"collab-folder",
@ -3263,7 +3265,7 @@ dependencies = [
[[package]]
name = "gotrue"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=648c977c0752609a00ccdfdc5cc8141789e63c4a#648c977c0752609a00ccdfdc5cc8141789e63c4a"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4643e568d2d9b725b0d06dfbbf351317cf9a2c9f#4643e568d2d9b725b0d06dfbbf351317cf9a2c9f"
dependencies = [
"anyhow",
"futures-util",
@ -3280,7 +3282,7 @@ dependencies = [
[[package]]
name = "gotrue-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=648c977c0752609a00ccdfdc5cc8141789e63c4a#648c977c0752609a00ccdfdc5cc8141789e63c4a"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4643e568d2d9b725b0d06dfbbf351317cf9a2c9f#4643e568d2d9b725b0d06dfbbf351317cf9a2c9f"
dependencies = [
"anyhow",
"app-error",
@ -3712,7 +3714,7 @@ dependencies = [
[[package]]
name = "infra"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=648c977c0752609a00ccdfdc5cc8141789e63c4a#648c977c0752609a00ccdfdc5cc8141789e63c4a"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4643e568d2d9b725b0d06dfbbf351317cf9a2c9f#4643e568d2d9b725b0d06dfbbf351317cf9a2c9f"
dependencies = [
"anyhow",
"bytes",
@ -6396,7 +6398,7 @@ dependencies = [
[[package]]
name = "shared-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=648c977c0752609a00ccdfdc5cc8141789e63c4a#648c977c0752609a00ccdfdc5cc8141789e63c4a"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=4643e568d2d9b725b0d06dfbbf351317cf9a2c9f#4643e568d2d9b725b0d06dfbbf351317cf9a2c9f"
dependencies = [
"anyhow",
"app-error",

View File

@ -13,7 +13,6 @@ impl EventIntegrationTest {
let payload = CreateViewPayloadPB {
parent_view_id: parent_id.to_string(),
name: "chat".to_string(),
desc: "".to_string(),
thumbnail: None,
layout: ViewLayoutPB::Chat,
initial_data: vec![],

View File

@ -38,7 +38,6 @@ impl EventIntegrationTest {
let payload = CreateViewPayloadPB {
parent_view_id: parent_id.to_string(),
name,
desc: "".to_string(),
thumbnail: None,
layout: ViewLayoutPB::Grid,
initial_data,
@ -71,7 +70,6 @@ impl EventIntegrationTest {
let payload = CreateViewPayloadPB {
parent_view_id: parent_id.to_string(),
name,
desc: "".to_string(),
thumbnail: None,
layout: ViewLayoutPB::Board,
initial_data,
@ -99,7 +97,6 @@ impl EventIntegrationTest {
let payload = CreateViewPayloadPB {
parent_view_id: parent_id.to_string(),
name,
desc: "".to_string(),
thumbnail: None,
layout: ViewLayoutPB::Calendar,
initial_data,

View File

@ -70,7 +70,6 @@ impl DocumentEventTest {
let payload = CreateViewPayloadPB {
parent_view_id: parent_id.to_string(),
name: "document".to_string(),
desc: "".to_string(),
thumbnail: None,
layout: ViewLayoutPB::Document,
initial_data: vec![],

View File

@ -31,7 +31,6 @@ impl EventIntegrationTest {
let payload = CreateViewPayloadPB {
parent_view_id: parent_id.to_string(),
name,
desc: "".to_string(),
thumbnail: None,
layout: ViewLayoutPB::Document,
initial_data,

View File

@ -125,7 +125,6 @@ impl EventIntegrationTest {
.map(|view| CreateViewParams {
parent_view_id: view.parent_view_id,
name: view.name,
desc: "".to_string(),
layout: view.layout.into(),
view_id: view.id,
initial_data: ViewData::Empty,
@ -154,7 +153,6 @@ impl EventIntegrationTest {
pub async fn create_orphan_view(&self, name: &str, view_id: &str, layout: ViewLayoutPB) {
let payload = CreateOrphanViewPayloadPB {
name: name.to_string(),
desc: "".to_string(),
layout,
view_id: view_id.to_string(),
initial_data: vec![],
@ -288,7 +286,6 @@ impl EventIntegrationTest {
let payload = CreateViewPayloadPB {
parent_view_id: parent_id.to_string(),
name,
desc: "".to_string(),
thumbnail: None,
layout,
initial_data: vec![],
@ -354,7 +351,6 @@ impl ViewTest {
let payload = CreateViewPayloadPB {
parent_view_id: workspace.id.clone(),
name: "View A".to_string(),
desc: "".to_string(),
thumbnail: Some("http://1.png".to_string()),
layout: layout.into(),
initial_data: data,

View File

@ -254,13 +254,12 @@ pub async fn create_view(
sdk: &EventIntegrationTest,
parent_view_id: &str,
name: &str,
desc: &str,
_desc: &str,
layout: ViewLayout,
) -> ViewPB {
let request = CreateViewPayloadPB {
parent_view_id: parent_view_id.to_string(),
name: name.to_string(),
desc: desc.to_string(),
thumbnail: None,
layout: layout.into(),
initial_data: vec![],

View File

@ -16,6 +16,4 @@ pub mod manager_test_util;
pub mod publish_util;
pub mod share;
#[cfg(feature = "test_helper")]
mod test_helper;
mod util;

View File

@ -1,58 +0,0 @@
use std::collections::HashMap;
use flowy_folder_pub::cloud::gen_view_id;
use crate::entities::{CreateViewParams, ViewLayoutPB, ViewSectionPB};
use crate::manager::FolderManager;
use crate::view_operation::ViewData;
#[cfg(feature = "test_helper")]
impl FolderManager {
pub async fn create_test_grid_view(
&self,
app_id: &str,
name: &str,
ext: HashMap<String, String>,
) -> String {
self
.create_test_view(app_id, name, ViewLayoutPB::Grid, ext)
.await
}
pub async fn create_test_board_view(
&self,
app_id: &str,
name: &str,
ext: HashMap<String, String>,
) -> String {
self
.create_test_view(app_id, name, ViewLayoutPB::Board, ext)
.await
}
async fn create_test_view(
&self,
app_id: &str,
name: &str,
layout: ViewLayoutPB,
ext: HashMap<String, String>,
) -> String {
let view_id = gen_view_id().to_string();
let params = CreateViewParams {
parent_view_id: app_id.to_string(),
name: name.to_string(),
desc: "".to_string(),
layout,
view_id: view_id.clone(),
initial_data: ViewData::Empty,
meta: ext,
set_as_current: true,
index: None,
section: Some(ViewSectionPB::Public),
icon: None,
extra: None,
};
self.create_view_with_params(params, true).await.unwrap();
view_id
}
}

View File

@ -19,7 +19,11 @@ impl UserDataMigration for CollabDocKeyWithWorkspaceIdMigration {
"collab_doc_key_with_workspace_id"
}
fn run_when(&self, first_installed_version: &Option<Version>, _current_version: &Version) -> bool {
fn run_when(
&self,
first_installed_version: &Option<Version>,
_current_version: &Version,
) -> bool {
match first_installed_version {
None => {
// The user's initial installed version is None if they were using an AppFlowy version

View File

@ -25,7 +25,11 @@ impl UserDataMigration for HistoricalEmptyDocumentMigration {
"historical_empty_document"
}
fn run_when(&self, first_installed_version: &Option<Version>, _current_version: &Version) -> bool {
fn run_when(
&self,
first_installed_version: &Option<Version>,
_current_version: &Version,
) -> bool {
match first_installed_version {
None => true,
Some(version) => version < &Version::new(0, 4, 0),

View File

@ -23,7 +23,11 @@ impl UserDataMigration for FavoriteV1AndWorkspaceArrayMigration {
"workspace_favorite_v1_and_workspace_array_migration"
}
fn run_when(&self, first_installed_version: &Option<Version>, _current_version: &Version) -> bool {
fn run_when(
&self,
first_installed_version: &Option<Version>,
_current_version: &Version,
) -> bool {
match first_installed_version {
None => true,
Some(version) => version < &Version::new(0, 4, 0),

View File

@ -21,7 +21,11 @@ impl UserDataMigration for WorkspaceTrashMapToSectionMigration {
"workspace_trash_map_to_section_migration"
}
fn run_when(&self, first_installed_version: &Option<Version>, _current_version: &Version) -> bool {
fn run_when(
&self,
first_installed_version: &Option<Version>,
_current_version: &Version,
) -> bool {
match first_installed_version {
None => true,
Some(version) => version < &Version::new(0, 4, 0),

View File

@ -4,7 +4,6 @@ use crate::services::entities::{UserConfig, UserPaths};
use crate::services::sqlite_sql::user_sql::vacuum_database;
use collab_integrate::CollabKVDB;
use arc_swap::ArcSwapOption;
use collab_plugins::local_storage::kv::doc::CollabKVAction;
use collab_plugins::local_storage::kv::KVTransactionDB;