Fix gallery date display (#445)

* Fix gallery date display

* Fix approved date not setting
This commit is contained in:
Geometrically
2022-09-04 13:37:11 -07:00
committed by GitHub
parent e7c3f8bf47
commit b25af641e2
4 changed files with 28 additions and 15 deletions

View File

@@ -121,7 +121,13 @@ impl ids::ProjectTypeId {
}
pub fn convert_postgres_date(input: &str) -> DateTime<Utc> {
DateTime::parse_from_str(input, "%Y-%m-%d %T%#z")
let mut result = DateTime::parse_from_str(input, "%Y-%m-%d %T.%f%#z");
if result.is_err() {
result = DateTime::parse_from_str(input, "%Y-%m-%d %T%#z")
}
result
.map(|x| x.with_timezone(&Utc))
.unwrap_or_else(|_| Utc::now())
}

View File

@@ -507,7 +507,7 @@ pub async fn project_edit(
"
UPDATE mods
SET approved = NOW()
WHERE id = $1 AND approved = NULL
WHERE id = $1 AND approved IS NULL
",
id as database::models::ids::ProjectId,
)

View File

@@ -16,7 +16,14 @@ impl super::Validator for PluginYmlValidator {
}
fn get_supported_loaders(&self) -> &[&str] {
&["bukkit", "spigot", "paper", "purpur", "bungeecord", "waterfall"]
&[
"bukkit",
"spigot",
"paper",
"purpur",
"bungeecord",
"waterfall",
]
}
fn get_supported_game_versions(&self) -> SupportedGameVersions {