]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Api/Twitter/Statuses/Destroy.php
Reenable Twitter/Destroy tests
[friendica.git] / src / Module / Api / Twitter / Statuses / Destroy.php
index a8c4be6f4e0b3228e22b40083b611a6dddba0d49..8c2a8bf3eb6e4d3f841c2123ba4189595602d188 100644 (file)
@@ -26,6 +26,7 @@ use Friendica\Module\BaseApi;
 use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Model\Item;
+use Friendica\Network\HTTPException\BadRequestException;
 
 /**
  * Destroys a specific status.
@@ -39,10 +40,12 @@ class Destroy extends BaseApi
                BaseApi::checkAllowedScope(BaseApi::SCOPE_READ);
                $uid = BaseApi::getCurrentUserID();
 
-               if (empty($this->parameters['id'])) {
-                       $id = intval($request['id'] ?? 0);
-               } else {
+               if (empty($this->parameters['id']) && !empty($request['id'])) {
+                       $id = intval($request['id']);
+               } elseif (!empty($this->parameters['id'])) {
                        $id = (int)$this->parameters['id'];
+               } else {
+                       throw new BadRequestException('An id is missing.');
                }
 
                $this->logger->notice('API: api_statuses_destroy: ' . $id);