]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Api/Mastodon/Conversations.php
Merge pull request #13176 from MrPetovan/bug/warnings
[friendica.git] / src / Module / Api / Mastodon / Conversations.php
index af2632ae6349f8606da9aa10ab4216bf5b013bab..fa8804f54290912f13616272f4542a0563bee56a 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -31,17 +31,17 @@ use Friendica\Module\BaseApi;
  */
 class Conversations extends BaseApi
 {
-       public static function delete()
+       protected function delete(array $request = [])
        {
                self::checkAllowedScope(self::SCOPE_WRITE);
                $uid = self::getCurrentUserID();
 
-               if (!empty(static::$parameters['id'])) {
+               if (!empty($this->parameters['id'])) {
                        DI::mstdnError()->UnprocessableEntity();
                }
 
-               DBA::delete('conv', ['id' => static::$parameters['id'], 'uid' => $uid]);
-               DBA::delete('mail', ['convid' => static::$parameters['id'], 'uid' => $uid]);
+               DBA::delete('conv', ['id' => $this->parameters['id'], 'uid' => $uid]);
+               DBA::delete('mail', ['convid' => $this->parameters['id'], 'uid' => $uid]);
 
                System::jsonExit([]);
        }
@@ -49,17 +49,17 @@ class Conversations extends BaseApi
        /**
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
-       public static function rawContent()
+       protected function rawContent(array $request = [])
        {
                self::checkAllowedScope(self::SCOPE_READ);
                $uid = self::getCurrentUserID();
 
-               $request = self::getRequest([
+               $request = $this->getRequest([
                        'limit'    => 20, // Maximum number of results. Defaults to 20. Max 40.
                        'max_id'   => 0,  // Return results older than this ID. Use HTTP Link header to paginate.
                        'since_id' => 0,  // Return results newer than this ID. Use HTTP Link header to paginate.
                        'min_id'   => 0,  // Return results immediately newer than this ID. Use HTTP Link header to paginate.
-               ]);
+               ], $request);
 
                $params = ['order' => ['id' => true], 'limit' => $request['limit']];
 
@@ -85,13 +85,13 @@ class Conversations extends BaseApi
 
                while ($conv = DBA::fetch($convs)) {
                        self::setBoundaries($conv['id']);
-                       $conversations[] = DI::mstdnConversation()->CreateFromConvId($conv['id']);
+                       $conversations[] = DI::mstdnConversation()->createFromConvId($conv['id']);
                }
 
                DBA::close($convs);
 
                if (!empty($request['min_id'])) {
-                       array_reverse($conversations);
+                       $conversations = array_reverse($conversations);
                }
 
                self::setLinkHeader();