diff --git a/app/Services/AccountSuspensionService.php b/app/Services/AccountSuspensionService.php index 2ee946c..6b8e66a 100755 --- a/app/Services/AccountSuspensionService.php +++ b/app/Services/AccountSuspensionService.php @@ -18,12 +18,12 @@ class AccountSuspensionService * Suspends a user account, with given $reason. * Permanent if no duration given. * - * @param string $reason Suspension reason. - * @param int $duration Duration in days * @param User $target Who to suspend. + * @param string $reason Suspension reason. + * @param int|null $duration Duration in days * @return Ban The ban itself */ - public function suspend(User $target, string $reason, int $duration = 0): Ban { + public function suspend(User $target, string $reason, int $duration = null): Ban { Log::alert("An user account has just been suspended.", [ 'taget_email' => $target->email, @@ -125,7 +125,7 @@ class AccountSuspensionService } public function getSuspensionDuration(User $user): string|null { - if ($this->isSuspended($user)) { + if ($this->isSuspended($user) && !is_null($user->bans->bannedUntil)) { return $user->bans->bannedUntil->diffForHumans(); }