diff --git a/src/database/queries/delete_tts_model.rs b/src/database/queries/delete_tts_model.rs index 47507def96..7ec6622aed 100644 --- a/src/database/queries/delete_tts_model.rs +++ b/src/database/queries/delete_tts_model.rs @@ -3,17 +3,20 @@ use sqlx::MySqlPool; pub async fn delete_tts_model_as_user( tts_model_token: &str, + creator_ip_address: &str, mysql_pool: &MySqlPool, ) -> AnyhowResult<()> { let _r = sqlx::query!( r#" UPDATE tts_models SET + creator_ip_address_last_update = ?, user_deleted_at = CURRENT_TIMESTAMP WHERE token = ? LIMIT 1 "#, + creator_ip_address, tts_model_token, ) .execute(mysql_pool) @@ -46,17 +49,20 @@ LIMIT 1 pub async fn undelete_tts_model_as_user( tts_model_token: &str, + creator_ip_address: &str, mysql_pool: &MySqlPool, ) -> AnyhowResult<()> { let _r = sqlx::query!( r#" UPDATE tts_models SET + creator_ip_address_last_update = ?, user_deleted_at = NULL WHERE token = ? LIMIT 1 "#, + creator_ip_address, tts_model_token, ) .execute(mysql_pool) diff --git a/src/http_server/endpoints/tts/delete_tts_model.rs b/src/http_server/endpoints/tts/delete_tts_model.rs index 4e3d77d9d3..5beaf9c408 100644 --- a/src/http_server/endpoints/tts/delete_tts_model.rs +++ b/src/http_server/endpoints/tts/delete_tts_model.rs @@ -118,8 +118,7 @@ pub async fn delete_tts_model_handler( return Err(DeleteTtsModelError::NotAuthorized); } - // NB: I can't imagine we need to store this. - // let ip_address = get_request_ip(&http_request); + let ip_address = get_request_ip(&http_request); let as_mod = delete_as_mod(is_mod, is_author, request.as_mod); @@ -133,7 +132,8 @@ pub async fn delete_tts_model_handler( } else { delete_tts_model_as_user( &path.token, - &server_state.mysql_pool + &ip_address, + &server_state.mysql_pool, ).await } } else { @@ -147,6 +147,7 @@ pub async fn delete_tts_model_handler( // NB: Technically only mods can see their own inference_results here undelete_tts_model_as_user( &path.token, + &ip_address, &server_state.mysql_pool ).await }