From 7ba797b8724b5dfa7201e9e03097aa10a81a3511 Mon Sep 17 00:00:00 2001 From: Zach Hirschtritt Date: Fri, 15 Nov 2024 01:46:33 -0500 Subject: [PATCH] fix: use correct check for user existing on import (#8907) # Which Problems Are Solved - ImportHuman was not checking for a `UserStateDeleted` state on import, resulting in "already existing" errors when attempting to delete and re-import a user with the same id # How the Problems Are Solved Use the `Exists` helper method to check for both `UserStateUnspecified` and `UserStateDeleted` states on import # Additional Changes N/A # Additional Context N/A Co-authored-by: Livio Spring --- internal/command/user_human.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/command/user_human.go b/internal/command/user_human.go index 91739e0d6d..ab2617c276 100644 --- a/internal/command/user_human.go +++ b/internal/command/user_human.go @@ -448,7 +448,7 @@ func (c *Commands) ImportHuman(ctx context.Context, orgID string, human *domain. return nil, nil, err } - if existing.UserState != domain.UserStateUnspecified { + if existing.UserState.Exists() { return nil, nil, zerrors.ThrowPreconditionFailed(nil, "COMMAND-ziuna", "Errors.User.AlreadyExisting") } }