summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2022-10-17 20:58:40 +0000
committerSanto Cariotti <santo@dcariotti.me>2022-10-17 20:58:40 +0000
commitbf6feab9cac0bbf54607ba3401a5116440abcf85 (patch)
treeb33e41d6b833a24afec17945a26cd2848e3578b8
parentfc296356c4e1b269fd55196e72791ea3fbf03b08 (diff)
Fix: edit warning for resolved_by already defined as number
-rw-r--r--src/warning/models.rs2
-rw-r--r--src/warning/routes.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/warning/models.rs b/src/warning/models.rs
index 9e79e6c..421ff38 100644
--- a/src/warning/models.rs
+++ b/src/warning/models.rs
@@ -59,7 +59,7 @@ pub struct WarningCreate {
#[derive(Deserialize)]
pub struct WarningEdit {
pub admin_note: String,
- pub resolved_by: Option<bool>,
+ pub resolved_by: Option<i32>,
}
/// Payload used for warning filtering
diff --git a/src/warning/routes.rs b/src/warning/routes.rs
index e57b8a8..bb08963 100644
--- a/src/warning/routes.rs
+++ b/src/warning/routes.rs
@@ -101,7 +101,7 @@ async fn edit_warning(
return Err(AppError::Unauthorized);
}
- if payload.resolved_by.is_none() || payload.resolved_by.unwrap() {
+ if payload.resolved_by.is_none() || payload.resolved_by.unwrap() > 0 {
warning.edit(Some(user.id), payload).await?;
} else {
warning.edit(None, payload).await?;