diff --git a/src/User/src/Service/UserService.php b/src/User/src/Service/UserService.php index 8fdf2c9..2ecb41f 100644 --- a/src/User/src/Service/UserService.php +++ b/src/User/src/Service/UserService.php @@ -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); } /** @@ -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) @@ -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); } /**