Move jsonError out of Factory\Api\Mastodon\Error->Unauthorized

This commit is contained in:
Hypolite Petovan 2023-10-11 09:24:13 -04:00
parent 7486ebdc10
commit 6a2ca1a6b6
4 changed files with 10 additions and 13 deletions

View file

@ -50,8 +50,8 @@ class Revoke extends BaseApi
$condition = ['client_id' => $request['client_id'], 'client_secret' => $request['client_secret'], 'access_token' => $request['token']];
$token = DBA::selectFirst('application-view', ['id'], $condition);
if (empty($token['id'])) {
Logger::notice('Token not found', $condition);
DI::mstdnError()->Unauthorized();
$this->logger->notice('Token not found', $condition);
$this->logErrorAndJsonExit(401, $this->errorFactory->Unauthorized());
}
DBA::delete('application-token', ['application-id' => $token['id']]);