From 6056005c0f0b7a479f500fec9df71a63afc36ca9 Mon Sep 17 00:00:00 2001 From: BlackDex Date: Tue, 7 Jan 2025 11:45:00 +0100 Subject: [PATCH] Adjust deleting records Signed-off-by: BlackDex --- src/api/core/organizations.rs | 4 ++-- src/api/core/public.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/api/core/organizations.rs b/src/api/core/organizations.rs index 3a9103aba2..6f404b5604 100644 --- a/src/api/core/organizations.rs +++ b/src/api/core/organizations.rs @@ -954,10 +954,10 @@ async fn send_invite(org_id: &str, data: Json, headers: AdminHeaders { // Upon error delete the user, invite and org member records when needed if user_created { - Invitation::take(email, &mut conn).await; user.delete(&mut conn).await?; + } else { + new_member.delete(&mut conn).await?; } - new_member.delete(&mut conn).await?; err!(format!("Error sending invite: {e:?} ")); }; diff --git a/src/api/core/public.rs b/src/api/core/public.rs index 3127dd8d77..f5f92e6211 100644 --- a/src/api/core/public.rs +++ b/src/api/core/public.rs @@ -135,10 +135,10 @@ async fn ldap_import(data: Json, token: PublicToken, mut conn: Db { // Upon error delete the user, invite and org member records when needed if user_created { - Invitation::take(&user_data.email.clone(), &mut conn).await; user.delete(&mut conn).await?; + } else { + new_member.delete(&mut conn).await?; } - new_member.delete(&mut conn).await?; err!(format!("Error sending invite: {e:?} ")); }