fix: add flag for disabling events instead of commenting them out (#695)

Signed-off-by: IAmTomahawkx <iamtomahawkx@gmail.com>
This commit is contained in:
Tom
2026-03-27 17:03:48 -07:00
committed by GitHub
parent 98c7b1b5a5
commit a5cd08a655
4 changed files with 59 additions and 44 deletions

View File

@@ -428,6 +428,8 @@ async fn worker(
mut read: WsReader,
write: &Mutex<WsWriter>,
) {
let revolt_config = revolt_config::config().await;
loop {
let t1 = read.try_next().fuse();
let t2 = kill_signal_r.recv().fuse();
@@ -463,31 +465,38 @@ async fn worker(
};
match payload {
// disabled events
// ClientMessage::BeginTyping { channel } => {
// if !subscribed.read().await.contains(&channel) {
// continue;
// }
ClientMessage::BeginTyping { channel } => {
if revolt_config.disable_events_dont_use {
continue;
}
// EventV1::ChannelStartTyping {
// id: channel.clone(),
// user: user_id.clone(),
// }
// .p(channel.clone())
// .await;
// }
// ClientMessage::EndTyping { channel } => {
// if !subscribed.read().await.contains(&channel) {
// continue;
// }
if !subscribed.read().await.contains(&channel) {
continue;
}
// EventV1::ChannelStopTyping {
// id: channel.clone(),
// user: user_id.clone(),
// }
// .p(channel.clone())
// .await;
// }
EventV1::ChannelStartTyping {
id: channel.clone(),
user: user_id.clone(),
}
.p(channel.clone())
.await;
}
ClientMessage::EndTyping { channel } => {
if revolt_config.disable_events_dont_use {
continue;
}
if !subscribed.read().await.contains(&channel) {
continue;
}
EventV1::ChannelStopTyping {
id: channel.clone(),
user: user_id.clone(),
}
.p(channel.clone())
.await;
}
ClientMessage::Subscribe { server_id } => {
let mut servers = active_servers.lock().await;
let has_item = servers.contains_key(&server_id);