X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FApi%2FMastodon%2FLists.php;h=beb1a3b9a62455fd552f6a2022726c8d6eaa145d;hb=7486ebdc10715b7204b70ce262052d28cb61c69e;hp=a007c80d33ae04f4a79196bd3ad3280b76d5c431;hpb=4f7740264ec1d5b7633e24f317d75d00ddf8caad;p=friendica.git diff --git a/src/Module/Api/Mastodon/Lists.php b/src/Module/Api/Mastodon/Lists.php index a007c80d33..beb1a3b9a6 100644 --- a/src/Module/Api/Mastodon/Lists.php +++ b/src/Module/Api/Mastodon/Lists.php @@ -33,27 +33,27 @@ class Lists extends BaseApi { protected function delete(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { - DI::mstdnError()->UnprocessableEntity(); + $this->logErrorAndJsonExit(422, $this->errorFactory->UnprocessableEntity()); } if (!Circle::exists($this->parameters['id'], $uid)) { - DI::mstdnError()->RecordNotFound(); + $this->logErrorAndJsonExit(404, $this->errorFactory->RecordNotFound()); } if (!Circle::remove($this->parameters['id'])) { DI::mstdnError()->InternalError(); } - System::jsonExit([]); + $this->jsonExit([]); } protected function post(array $request = []) { - self::checkAllowedScope(self::SCOPE_WRITE); + $this->checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); $request = $this->getRequest([ @@ -61,7 +61,7 @@ class Lists extends BaseApi ], $request); if (empty($request['title'])) { - DI::mstdnError()->UnprocessableEntity(); + $this->logErrorAndJsonExit(422, $this->errorFactory->UnprocessableEntity()); } Circle::create($uid, $request['title']); @@ -71,7 +71,7 @@ class Lists extends BaseApi DI::mstdnError()->InternalError(); } - System::jsonExit(DI::mstdnList()->createFromCircleId($id)); + $this->jsonExit(DI::mstdnList()->createFromCircleId($id)); } public function put(array $request = []) @@ -82,7 +82,7 @@ class Lists extends BaseApi ], $request); if (empty($request['title']) || empty($this->parameters['id'])) { - DI::mstdnError()->UnprocessableEntity(); + $this->logErrorAndJsonExit(422, $this->errorFactory->UnprocessableEntity()); } Circle::update($this->parameters['id'], $request['title']); @@ -93,7 +93,7 @@ class Lists extends BaseApi */ protected function rawContent(array $request = []) { - self::checkAllowedScope(self::SCOPE_READ); + $this->checkAllowedScope(self::SCOPE_READ); $uid = self::getCurrentUserID(); if (empty($this->parameters['id'])) { @@ -106,11 +106,11 @@ class Lists extends BaseApi $id = $this->parameters['id']; if (!Circle::exists($id, $uid)) { - DI::mstdnError()->RecordNotFound(); + $this->logErrorAndJsonExit(404, $this->errorFactory->RecordNotFound()); } $lists = DI::mstdnList()->createFromCircleId($id); } - System::jsonExit($lists); + $this->jsonExit($lists); } }