Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
Signed-off-by: bidi <[email protected]>
  • Loading branch information
bidi47 committed Dec 16, 2024
1 parent 1b9d2a4 commit ec0ad08
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions src/User/src/Service/UserService.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,7 @@ public function __construct(
*/
public function findByUuid(string $uuid): ?User
{
$user = $this->userRepository->findByUuid($uuid);

if (! $user instanceof User || $user->isDeleted()) {
return null;
}

return $user;
return $this->userRepository->findByUuid($uuid);
}

/**
Expand Down Expand Up @@ -182,11 +176,11 @@ public function updateUser(User $user, array $data = []): User

public function deleteUser(User $user): User
{
$user->setStatus(UserStatusEnum::Deleted);
$placeholder = $this->getAnonymousPlaceholder();

// make user anonymous
$user
->setStatus(UserStatusEnum::Deleted)
->setIdentity($placeholder . $this->config['userAnonymizeAppend'])
->getDetail()
->setFirstName($placeholder)
Expand Down Expand Up @@ -331,13 +325,7 @@ public function findByResetPasswordHash(?string $hash): ?User
return null;
}

$user = $this->userRepository->findByResetPasswordHash($hash);

if (! $user instanceof User || $user->isDeleted()) {
return null;
}

return $user;
return $this->userRepository->findByResetPasswordHash($hash);
}

/**
Expand Down

0 comments on commit ec0ad08

Please sign in to comment.