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

@@ -1091,18 +1091,6 @@
},
"query": "\n SELECT id, team_id, role, permissions, accepted, payouts_split\n FROM team_members\n WHERE (user_id = $1 AND accepted = TRUE)\n "
},
"28be156dc8d8c394dd7c8de33a8e45be9c2d9033de461c0b7365cd8e7585aa8d": {
"describe": {
"columns": [],
"nullable": [],
"parameters": {
"Left": [
"Int8"
]
}
},
"query": "\n UPDATE mods\n SET approved = NOW()\n WHERE id = $1 AND approved = NULL\n "
},
"28d5825964b0fddc43bd7d6851daf91845b79c9e88c82d5c7d97ae02502d0b4f": {
"describe": {
"columns": [],
@@ -3718,6 +3706,18 @@
},
"query": "\n DELETE FROM mods_categories\n WHERE joining_mod_id = $1 AND is_additional = FALSE\n "
},
"a11d613479d09dff5fcdc45ab7a0341fb1b4738f0ede71572d939ef0984bd65f": {
"describe": {
"columns": [],
"nullable": [],
"parameters": {
"Left": [
"Int8"
]
}
},
"query": "\n UPDATE mods\n SET approved = NOW()\n WHERE id = $1 AND approved IS NULL\n "
},
"a1e3ac170e45196e5fcca154c96a206f35be68a3219a0d493e1e149206590043": {
"describe": {
"columns": [

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 {