From 748e33566b1fbc4b7bddcaeafb8d955ea610e7e9 Mon Sep 17 00:00:00 2001 From: jude Date: Mon, 19 Aug 2024 21:45:24 +0100 Subject: [PATCH 1/3] Fix patreon not sharing between guild members --- .../src/components/Reminder/Settings.tsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/reminder-dashboard/src/components/Reminder/Settings.tsx b/reminder-dashboard/src/components/Reminder/Settings.tsx index 463c300..ac151fa 100644 --- a/reminder-dashboard/src/components/Reminder/Settings.tsx +++ b/reminder-dashboard/src/components/Reminder/Settings.tsx @@ -1,8 +1,7 @@ import { ChannelSelector } from "./ChannelSelector"; -import { DateTime } from "luxon"; import { IntervalSelector } from "./IntervalSelector"; import { useQuery } from "react-query"; -import { fetchUserInfo } from "../../api"; +import { fetchGuildInfo, fetchUserInfo } from "../../api"; import { useReminder } from "./ReminderContext"; import { Attachment } from "./Attachment"; import { TTS } from "./TTS"; @@ -11,11 +10,12 @@ import { useGuild } from "../App/useGuild"; export const Settings = () => { const guild = useGuild(); - const { isSuccess: userFetched, data: userInfo } = useQuery(fetchUserInfo()); + const { isSuccess: userFetched, data: userInfo } = useQuery({ ...fetchUserInfo() }); + const { isSuccess: guildFetched, data: guildInfo } = useQuery({ ...fetchGuildInfo(guild) }); const [reminder, setReminder] = useReminder(); - if (!userFetched) { + if (!userFetched || !guildFetched) { return <>; } @@ -59,7 +59,13 @@ export const Settings = () => {
-
+
Intervals available on Patreon{" "} or{" "} From b6ff149d511394951081583dd004f776ae6e7304 Mon Sep 17 00:00:00 2001 From: jude Date: Sat, 14 Sep 2024 12:07:09 +0100 Subject: [PATCH 2/3] Fix macro list/delete --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/commands/command_macro/delete_macro.rs | 2 +- src/models/mod.rs | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5730115..556c72c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2431,7 +2431,7 @@ checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "reminder-rs" -version = "1.7.24" +version = "1.7.26" dependencies = [ "base64 0.22.1", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 4bf6fdb..7e1192a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "reminder-rs" -version = "1.7.24" +version = "1.7.26" authors = ["Jude Southworth "] edition = "2021" license = "AGPL-3.0 only" diff --git a/src/commands/command_macro/delete_macro.rs b/src/commands/command_macro/delete_macro.rs index e89029d..d7861f1 100644 --- a/src/commands/command_macro/delete_macro.rs +++ b/src/commands/command_macro/delete_macro.rs @@ -20,7 +20,7 @@ pub async fn delete_macro( SELECT m.id FROM command_macro m INNER JOIN guilds - ON guilds.guild = m.guild_id + ON guilds.id = m.guild_id WHERE guild = ? AND m.name = ? ", diff --git a/src/models/mod.rs b/src/models/mod.rs index 4da5edb..f40fa7b 100644 --- a/src/models/mod.rs +++ b/src/models/mod.rs @@ -68,7 +68,7 @@ impl Data { guild_id: GuildId, ) -> Result, Error> { let rows = sqlx::query!( - "SELECT name, description, commands FROM macro WHERE guild_id = (SELECT id FROM guilds WHERE guild = ?)", + "SELECT name, description, commands FROM command_macro WHERE guild_id = (SELECT id FROM guilds WHERE guild = ?)", guild_id.get() ) .fetch_all(&self.database) @@ -76,7 +76,7 @@ impl Data { guild_id, name: row.name.clone(), description: row.description.clone(), - commands: serde_json::from_str(&row.commands).unwrap(), + commands: serde_json::from_str(&row.commands.to_string()).unwrap(), }).collect(); Ok(rows) From 9a6b65f3a3af6e4a3c2140f1f259839a96b22db9 Mon Sep 17 00:00:00 2001 From: jude Date: Tue, 17 Sep 2024 23:47:27 +0100 Subject: [PATCH 3/3] Don't delete guild data when guild becomes unavailable --- Cargo.toml | 2 +- src/event_handlers.rs | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7e1192a..6526a94 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "reminder-rs" -version = "1.7.26" +version = "1.7.27" authors = ["Jude Southworth "] edition = "2021" license = "AGPL-3.0 only" diff --git a/src/event_handlers.rs b/src/event_handlers.rs index 80cc258..4fb5347 100644 --- a/src/event_handlers.rs +++ b/src/event_handlers.rs @@ -55,9 +55,11 @@ To stay up to date on the latest features and fixes, join our [Discord](https:// } } FullEvent::GuildDelete { incomplete, .. } => { - let _ = sqlx::query!("DELETE FROM guilds WHERE guild = ?", incomplete.id.get()) - .execute(&data.database) - .await; + if !incomplete.unavailable { + let _ = sqlx::query!("DELETE FROM guilds WHERE guild = ?", incomplete.id.get()) + .execute(&data.database) + .await; + } } FullEvent::InteractionCreate { interaction } => { if let Some(component) = interaction.clone().message_component() {