From 21daf3aec693beae55bff51235e5e4b7d90f2362 Mon Sep 17 00:00:00 2001 From: Zomatree Date: Fri, 3 Jul 2026 03:23:52 +0100 Subject: [PATCH] fix: allow removing channel slowmode (#836) Signed-off-by: Zomatree --- crates/core/database/src/models/channels/model.rs | 8 ++++++++ crates/core/database/src/util/bridge/v0.rs | 2 ++ crates/core/models/src/v0/channels.rs | 1 + crates/delta/src/routes/channels/channel_edit.rs | 3 +++ 4 files changed, 14 insertions(+) diff --git a/crates/core/database/src/models/channels/model.rs b/crates/core/database/src/models/channels/model.rs index 9712f5aa..2d275395 100644 --- a/crates/core/database/src/models/channels/model.rs +++ b/crates/core/database/src/models/channels/model.rs @@ -161,6 +161,7 @@ auto_derived!( Icon, DefaultPermissions, Voice, + Slowmode, } ); @@ -554,6 +555,12 @@ impl Channel { } _ => {} }, + FieldsChannel::Slowmode => match self { + Self::TextChannel { slowmode, .. } => { + slowmode.take(); + } + _ => {} + } } } @@ -777,6 +784,7 @@ impl IntoDocumentPath for FieldsChannel { FieldsChannel::Icon => "icon", FieldsChannel::DefaultPermissions => "default_permissions", FieldsChannel::Voice => "voice", + FieldsChannel::Slowmode => "slowmode", }) } } diff --git a/crates/core/database/src/util/bridge/v0.rs b/crates/core/database/src/util/bridge/v0.rs index 2cce6799..102bdf3b 100644 --- a/crates/core/database/src/util/bridge/v0.rs +++ b/crates/core/database/src/util/bridge/v0.rs @@ -319,6 +319,7 @@ impl From for crate::FieldsChannel { FieldsChannel::Icon => crate::FieldsChannel::Icon, FieldsChannel::DefaultPermissions => crate::FieldsChannel::DefaultPermissions, FieldsChannel::Voice => crate::FieldsChannel::Voice, + FieldsChannel::Slowmode => crate::FieldsChannel::Slowmode, } } } @@ -330,6 +331,7 @@ impl From for FieldsChannel { crate::FieldsChannel::Icon => FieldsChannel::Icon, crate::FieldsChannel::DefaultPermissions => FieldsChannel::DefaultPermissions, crate::FieldsChannel::Voice => FieldsChannel::Voice, + crate::FieldsChannel::Slowmode => FieldsChannel::Slowmode, } } } diff --git a/crates/core/models/src/v0/channels.rs b/crates/core/models/src/v0/channels.rs index faddee74..8e32a8aa 100644 --- a/crates/core/models/src/v0/channels.rs +++ b/crates/core/models/src/v0/channels.rs @@ -164,6 +164,7 @@ auto_derived!( Icon, DefaultPermissions, Voice, + Slowmode, } /// New webhook information diff --git a/crates/delta/src/routes/channels/channel_edit.rs b/crates/delta/src/routes/channels/channel_edit.rs index 25ead30b..8ef439fa 100644 --- a/crates/delta/src/routes/channels/channel_edit.rs +++ b/crates/delta/src/routes/channels/channel_edit.rs @@ -221,6 +221,9 @@ pub async fn edit( v0::FieldsChannel::Voice => { voice.take(); } + v0::FieldsChannel::Slowmode => { + slowmode.take(); + } _ => {} } }