Skip to content

Commit

Permalink
Fixed issue where group assignment would be lost on check PATCH.
Browse files Browse the repository at this point in the history
  • Loading branch information
apognu committed Jan 18, 2024
1 parent ad919fa commit 87ea823
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/api/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,13 @@ pub async fn patch(_: Auth, pool: State<Pool<MySql>>, Path(uuid): Path<String>,
payload.silent.run(|value| check.silent = value);

if let Some(value) = payload.group {
let group = Group::by_uuid(&mut txn, &value).await.context("could not retrieve group").short()?;
if value.is_empty() {
check.group_id = None;
} else {
let group = Group::by_uuid(&mut txn, &value).await.context("could not retrieve group").short()?;

check.group_id = Some(group.id);
} else {
check.group_id = None;
check.group_id = Some(group.id);
}
}

if let Some(value) = payload.alerter {
Expand Down

0 comments on commit 87ea823

Please sign in to comment.