From 25b84880a5df2e050c3d8b6118afc90047c86799 Mon Sep 17 00:00:00 2001 From: jude Date: Thu, 4 Aug 2022 19:06:29 +0100 Subject: [PATCH] Don't send non-interval disabled reminders Skip the sending logic as some users use disabled one-time reminders as presets --- Cargo.lock | 2 +- Cargo.toml | 2 +- migration/01-reminder_message_embed.sql | 5 +++++ postman/src/sender.rs | 9 +++++++-- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b95929a..04c1b9d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2068,7 +2068,7 @@ checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" [[package]] name = "reminder_rs" -version = "1.6.2" +version = "1.6.3" dependencies = [ "base64", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 699190e..d4c6383 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "reminder_rs" -version = "1.6.2" +version = "1.6.3" authors = ["jellywx "] edition = "2018" diff --git a/migration/01-reminder_message_embed.sql b/migration/01-reminder_message_embed.sql index 2bab286..23df3c0 100644 --- a/migration/01-reminder_message_embed.sql +++ b/migration/01-reminder_message_embed.sql @@ -157,4 +157,9 @@ CREATE TABLE events ( FOREIGN KEY (reminder_id) REFERENCES reminders_new(id) ON DELETE SET NULL ); +DROP TABLE reminders; +DROP TABLE embed_fields; +RENAME TABLE reminders_new TO reminders; +RENAME TABLE embed_fields_new TO embed_fields; + SET FOREIGN_KEY_CHECKS = 1; diff --git a/postman/src/sender.rs b/postman/src/sender.rs index 78ddc67..b2ee3be 100644 --- a/postman/src/sender.rs +++ b/postman/src/sender.rs @@ -301,8 +301,13 @@ WHERE ON reminders.channel_id = channels.id WHERE reminders.`utc_time` < NOW() GROUP BY channels.guild_id - ) AND - reminders.`utc_time` < NOW()"#, + ) + AND reminders.`utc_time` < NOW() + AND ( + reminders.`interval_seconds` IS NOT NULL + OR reminders.`interval_months` IS NOT NULL + OR reminders.enabled + )"#, ) .fetch_all(pool) .await