fixes in ux

This commit is contained in:
Mateusz Gruszczyński
2026-07-20 23:10:53 +02:00
parent 94a8907f02
commit f5292aefd6
7 changed files with 49 additions and 17 deletions
+3 -1
View File
@@ -172,7 +172,9 @@ async fn note(
match db::find_note(&state.db, workspace.id, &note_slug).await {
Ok(Some(note)) => {
let html = include_str!("../static/note.html")
.replace("__NOTE_TITLE__", &escape_html(&note.title));
.replace("__NOTE_TITLE__", &escape_html(&note.title))
.replace("__WORKSPACE_TITLE__", &escape_html(&workspace.title))
.replace("__WORKSPACE_SLUG__", &escape_html(&workspace_slug));
versioned_html(&html, &state.asset_version)
},
Ok(None) => error_response(
+18 -1
View File
@@ -204,7 +204,23 @@ pub fn normalize_timestamp(value: &str) -> String {
return timestamp.with_timezone(&Utc).to_rfc3339();
}
for format in ["%Y-%m-%d %H:%M:%S%.f%:z", "%Y-%m-%d %H:%M:%S%.f%#z"] {
// PostgreSQL renders TEXT timestamps as e.g. `2026-07-20 14:32:10.123456+00`.
// RFC 3339 requires `T` and a colon in the numeric offset.
let mut postgres = value.replacen(' ', "T", 1);
if postgres.len() >= 3 {
let offset_start = postgres.len() - 3;
let offset = &postgres[offset_start..];
if (offset.starts_with('+') || offset.starts_with('-'))
&& offset[1..].chars().all(|character| character.is_ascii_digit())
{
postgres.push_str(":00");
}
}
if let Ok(timestamp) = DateTime::parse_from_rfc3339(&postgres) {
return timestamp.with_timezone(&Utc).to_rfc3339();
}
for format in ["%Y-%m-%d %H:%M:%S%.f%:z", "%Y-%m-%dT%H:%M:%S%.f%:z"] {
if let Ok(timestamp) = DateTime::parse_from_str(value, format) {
return timestamp.with_timezone(&Utc).to_rfc3339();
}
@@ -216,6 +232,7 @@ pub fn normalize_timestamp(value: &str) -> String {
}
}
// Existing rows should still be readable even if they were stored without a zone.
value.to_string()
}