From a2d442bc54343322955251c222f0b9ff64782bf8 Mon Sep 17 00:00:00 2001 From: jude Date: Sun, 12 Nov 2023 17:17:22 +0000 Subject: [PATCH] Reset intervals correctly --- reminder-dashboard | 2 +- web/src/routes/dashboard/api/guild/reminders.rs | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/reminder-dashboard b/reminder-dashboard index 8ba7a39..d068782 160000 --- a/reminder-dashboard +++ b/reminder-dashboard @@ -1 +1 @@ -Subproject commit 8ba7a39ce532907b845c54dd3b54bf2a4c7a04e9 +Subproject commit d068782596bb85d883a594633e9b516c1bc428fc diff --git a/web/src/routes/dashboard/api/guild/reminders.rs b/web/src/routes/dashboard/api/guild/reminders.rs index 1cb67d2..9b7c6e2 100644 --- a/web/src/routes/dashboard/api/guild/reminders.rs +++ b/web/src/routes/dashboard/api/guild/reminders.rs @@ -235,6 +235,21 @@ pub async fn edit_reminder( ]); } } + } else { + sqlx::query!( + " + UPDATE reminders + SET interval_seconds = NULL, interval_days = NULL, interval_months = NULL + WHERE uid = ? + ", + reminder.uid + ) + .execute(transaction.executor()) + .await + .map_err(|e| { + warn!("Error updating reminder interval: {:?}", e); + json!({ "reminder": Option::::None, "errors": vec!["Unknown error"] }) + })?; } if reminder.channel > 0 {