From 6f03fae2335895dfc7db6abfa8aabe270a028297 Mon Sep 17 00:00:00 2001 From: Emma Alexia Date: Thu, 26 Jun 2025 13:30:58 -0600 Subject: [PATCH] Clear owner's project cache after deleting organization (#3794) * Clear owner's project cache after deleting organization Fixes an issue where people would think their projects were deleted along with their organization, when this isn't actually the case. * address PR review * Update apps/labrinth/src/routes/v3/organizations.rs Signed-off-by: Emma Alexia * Fix lint * actually fix lint --------- Signed-off-by: Emma Alexia --- apps/labrinth/src/routes/v3/organizations.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/labrinth/src/routes/v3/organizations.rs b/apps/labrinth/src/routes/v3/organizations.rs index 0f8fe35e1..da726d830 100644 --- a/apps/labrinth/src/routes/v3/organizations.rs +++ b/apps/labrinth/src/routes/v3/organizations.rs @@ -667,8 +667,13 @@ pub async fn organization_delete( ) .await?; - for team_id in organization_project_teams { - database::models::DBTeamMember::clear_cache(team_id, &redis).await?; + for team_id in &organization_project_teams { + database::models::DBTeamMember::clear_cache(*team_id, &redis).await?; + } + + if !organization_project_teams.is_empty() { + database::models::DBUser::clear_project_cache(&[owner_id], &redis) + .await?; } if result.is_some() {