mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: empty url group bug (#1755)
* fix: empty url group bug moving a row to empty url (no status) group would change the row's url to the group id which is not empty, its a random string. fixed it with puting a check to fill the url with the empty string when the group id is equal to empty url group id * fix: move empty group check to `insert_url_cell` because evereywhere using `insert_url_cell` we want to check that. * chore: cargo fmt --------- Co-authored-by: nathan <nathan@appflowy.io>
This commit is contained in:
parent
91b942d319
commit
59cb4a890a
@ -2,6 +2,7 @@ use crate::entities::FieldType;
|
||||
use crate::services::cell::{AtomicCellDataCache, CellProtobufBlob, TypeCellData};
|
||||
use crate::services::field::*;
|
||||
|
||||
use crate::services::group::make_no_status_group;
|
||||
use flowy_error::{ErrorCode, FlowyError, FlowyResult};
|
||||
use grid_model::{CellRevision, FieldRevision};
|
||||
|
||||
@ -223,6 +224,16 @@ pub fn insert_number_cell(num: i64, field_rev: &FieldRevision) -> CellRevision {
|
||||
}
|
||||
|
||||
pub fn insert_url_cell(url: String, field_rev: &FieldRevision) -> CellRevision {
|
||||
// checking if url is equal to group id of no status group because everywhere
|
||||
// except group of rows with empty url the group id is equal to the url
|
||||
// so then on the case that url is equal to empty url group id we should change
|
||||
// the url to empty string
|
||||
let _no_status_group_id = make_no_status_group(field_rev).id;
|
||||
let url = match url {
|
||||
a if a == _no_status_group_id => "".to_owned(),
|
||||
_ => url,
|
||||
};
|
||||
|
||||
let data = apply_cell_data_changeset(url, None, field_rev, None).unwrap();
|
||||
CellRevision::new(data)
|
||||
}
|
||||
|
@ -197,6 +197,7 @@ impl GroupGenerator for URLGroupGenerator {
|
||||
let group_configs = cells
|
||||
.into_iter()
|
||||
.flat_map(|value| value.into_url_field_cell_data())
|
||||
.filter(|cell| !cell.content.is_empty())
|
||||
.map(|cell| GeneratedGroupConfig {
|
||||
group_rev: make_group_from_url_cell(&cell),
|
||||
filter_content: cell.content,
|
||||
|
Loading…
Reference in New Issue
Block a user