fix: some database bugs (#5210)

* fix: open logic for url cell in database

* fix: row date created not working

* fix: help my toasts are burnt

* chore: quote style and add comment
This commit is contained in:
Richard Shiue
2024-04-29 17:34:18 +08:00
committed by GitHub
parent 9135fb94ad
commit e0d6b194bf
3 changed files with 19 additions and 28 deletions

View File

@ -10,7 +10,8 @@ use crate::services::database_view::{
use crate::services::field::{
default_type_option_data_from_type, select_type_option_from_field, transform_type_option,
type_option_data_from_pb, ChecklistCellChangeset, RelationTypeOption, SelectOptionCellChangeset,
StrCellData, TimestampCellData, TypeOptionCellDataHandler, TypeOptionCellExt,
StrCellData, TimestampCellData, TimestampCellDataWrapper, TypeOptionCellDataHandler,
TypeOptionCellExt,
};
use crate::services::field_settings::{default_field_settings_by_layout_map, FieldSettings};
use crate::services::filter::{Filter, FilterChangeset};
@ -722,12 +723,12 @@ impl DatabaseEditor {
match field_type {
FieldType::LastEditedTime | FieldType::CreatedTime => {
let row = database.get_row(row_id);
let cell_data = if field_type.is_created_time() {
TimestampCellData::new(row.created_at)
let wrapped_cell_data = if field_type.is_created_time() {
TimestampCellDataWrapper::from((field_type, TimestampCellData::new(row.created_at)))
} else {
TimestampCellData::new(row.modified_at)
TimestampCellDataWrapper::from((field_type, TimestampCellData::new(row.modified_at)))
};
Some(Cell::from(cell_data))
Some(Cell::from(wrapped_cell_data))
},
_ => database.get_cell(field_id, row_id).cell,
}