feat: added audit log on channel update
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful

This commit is contained in:
BAaboe 2025-08-05 12:21:48 +02:00
parent d84b7cf126
commit 362e4bc2e8
2 changed files with 5 additions and 1 deletions

View file

@ -115,12 +115,15 @@ pub async fn patch(
.await?; .await?;
if let Some(new_name) = &new_info.name { if let Some(new_name) = &new_info.name {
let log_entrie = AuditLog::new(channel.guild_uuid, AuditLogId::ChannelUpdateName as i16, member.uuid, Some(channel_uuid), None, None, None, None, Some(channel.name.clone()), Some(new_name.clone())).await;
channel channel
.set_name(&mut conn, &app_state.cache_pool, new_name.to_string()) .set_name(&mut conn, &app_state.cache_pool, new_name.to_string())
.await?; .await?;
log_entrie.push(&mut conn).await?;
} }
if let Some(new_description) = &new_info.description { if let Some(new_description) = &new_info.description {
let log_entrie = AuditLog::new(channel.guild_uuid, AuditLogId::ChannelUpdateDescripiton as i16, member.uuid, Some(channel_uuid), None, None, None, None, Some(channel.description.clone().unwrap_or("".to_string())), Some(new_description.clone())).await;
channel channel
.set_description( .set_description(
&mut conn, &mut conn,
@ -128,6 +131,7 @@ pub async fn patch(
new_description.to_string(), new_description.to_string(),
) )
.await?; .await?;
log_entrie.push(&mut conn).await?;
} }
if let Some(new_is_above) = &new_info.is_above { if let Some(new_is_above) = &new_info.is_above {

View file

@ -53,7 +53,7 @@ pub struct Channel {
pub uuid: Uuid, pub uuid: Uuid,
pub guild_uuid: Uuid, pub guild_uuid: Uuid,
pub name: String, pub name: String,
description: Option<String>, pub description: Option<String>,
pub is_above: Option<Uuid>, pub is_above: Option<Uuid>,
pub permissions: Vec<ChannelPermission>, pub permissions: Vec<ChannelPermission>,
} }