fix: store server id in redis and in room metadata to be able to delete voice state in all scenarios (#656)

* fix: store server id in redis values and in room metadata to be able to fully delete voice state in all scenarios

* fix: undo logging change
This commit is contained in:
Angelo Kontaxis
2026-03-10 22:14:32 +00:00
committed by GitHub
parent b0b728fb0d
commit 49c6289580
15 changed files with 322 additions and 154 deletions

View File

@@ -1,7 +1,10 @@
use revolt_database::{
AMQP, Channel, Database, PartialChannel, User, util::{permissions::DatabasePermissionQuery, reference::Reference}, voice::{
VoiceClient, delete_voice_channel, is_in_voice_channel, remove_user_from_voice_channel
}
util::{permissions::DatabasePermissionQuery, reference::Reference},
voice::{
delete_voice_channel, is_in_voice_channel, remove_user_from_voice_channel,
UserVoiceChannel, VoiceClient,
},
Channel, Database, PartialChannel, User, AMQP,
};
use revolt_models::v0;
use revolt_permissions::{calculate_channel_permissions, ChannelPermission};
@@ -54,15 +57,17 @@ pub async fn delete(
)
.await?;
if is_in_voice_channel(&user.id, channel.id()).await? {
remove_user_from_voice_channel(db, voice_client, channel.id(), &user.id).await?;
let user_voice_channel = UserVoiceChannel::from_channel(&channel);
if is_in_voice_channel(&user.id, &user_voice_channel).await? {
remove_user_from_voice_channel(voice_client, &user_voice_channel, &user.id).await?;
};
}
Channel::TextChannel { .. } => {
permissions.throw_if_lacking_channel_permission(ChannelPermission::ManageChannel)?;
channel.delete(db).await?;
delete_voice_channel(voice_client, channel.id(), channel.server()).await?;
delete_voice_channel(voice_client, &UserVoiceChannel::from_channel(&channel)).await?;
}
};