feat(users): add suspended user warning
This commit is contained in:
@@ -36,7 +36,7 @@ class Ban extends Model
|
||||
];
|
||||
|
||||
public $dates = [
|
||||
'suspendedUntil',
|
||||
'bannedUntil',
|
||||
];
|
||||
|
||||
public function user()
|
||||
|
@@ -174,6 +174,7 @@ class UserController extends Controller
|
||||
'isLocked' => $suspensionService->isLocked($user),
|
||||
'isSuspended' => $suspensionService->isSuspended($user),
|
||||
'suspensionReason' => $suspensionService->getSuspensionReason($user),
|
||||
'suspensionDuration' => $suspensionService->getSuspensionDuration($user),
|
||||
'has2FA' => $user->has2FA(),
|
||||
'applications' => $user->applications()->get()
|
||||
]);
|
||||
|
@@ -124,7 +124,13 @@ class AccountSuspensionService
|
||||
return ($this->isSuspended($user)) ? $user->bans->reason : false;
|
||||
}
|
||||
|
||||
public function getSuspensionDuration(User $user): string|null {
|
||||
if ($this->isSuspended($user)) {
|
||||
return $user->bans->bannedUntil->diffForHumans();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Checks whether an account is locked
|
||||
*
|
||||
|
Reference in New Issue
Block a user