From 8294fafebabac12d2fc72c1ae92f4a91c492be88 Mon Sep 17 00:00:00 2001 From: Rafael Bradley Date: Sat, 23 Aug 2025 02:19:05 -0300 Subject: [PATCH] Disable expire incident button when the incident has already expired --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/groups/moderation/components.rs | 3 ++- src/groups/moderation/mod.rs | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dfe48a3..aba3cfb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1437,7 +1437,7 @@ checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3" [[package]] name = "payphone" -version = "4.2.8" +version = "4.2.10" dependencies = [ "async-trait", "axum", diff --git a/Cargo.toml b/Cargo.toml index ec6d7f4..65fbfb1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "payphone" -version = "4.2.8" +version = "4.2.10" edition = "2024" default-run = "payphone" diff --git a/src/groups/moderation/components.rs b/src/groups/moderation/components.rs index d620000..558bb2b 100644 --- a/src/groups/moderation/components.rs +++ b/src/groups/moderation/components.rs @@ -83,6 +83,7 @@ pub struct ExpireIncidentButton { pub user_id: u64, pub incident_id: u64, pub incident_index: usize, + pub is_enabled: bool, } #[async_trait] @@ -100,7 +101,7 @@ impl Button for ExpireIncidentButton { } fn disabled(&self) -> bool { - false + !self.is_enabled } async fn on_press( diff --git a/src/groups/moderation/mod.rs b/src/groups/moderation/mod.rs index df2a8b0..40fda49 100644 --- a/src/groups/moderation/mod.rs +++ b/src/groups/moderation/mod.rs @@ -85,6 +85,7 @@ pub(super) async fn get_incident_page( incident_id: incident.incident_id, incident_index: page_index, user_id, + is_enabled: incident.is_active(), }, 2, );