]> git.mxchange.org Git - friendica.git/commitdiff
Switch parameters
authorMichael <heluecht@pirati.ca>
Wed, 25 Jan 2023 20:14:33 +0000 (20:14 +0000)
committerMichael <heluecht@pirati.ca>
Wed, 25 Jan 2023 20:14:33 +0000 (20:14 +0000)
22 files changed:
src/Factory/Api/Mastodon/Status.php
src/Module/Api/Mastodon/Accounts/Statuses.php
src/Module/Api/Mastodon/Bookmarks.php
src/Module/Api/Mastodon/Favourited.php
src/Module/Api/Mastodon/Search.php
src/Module/Api/Mastodon/Statuses.php
src/Module/Api/Mastodon/Statuses/Bookmark.php
src/Module/Api/Mastodon/Statuses/Context.php
src/Module/Api/Mastodon/Statuses/Favourite.php
src/Module/Api/Mastodon/Statuses/Mute.php
src/Module/Api/Mastodon/Statuses/Pin.php
src/Module/Api/Mastodon/Statuses/Reblog.php
src/Module/Api/Mastodon/Statuses/Unbookmark.php
src/Module/Api/Mastodon/Statuses/Unfavourite.php
src/Module/Api/Mastodon/Statuses/Unmute.php
src/Module/Api/Mastodon/Statuses/Unpin.php
src/Module/Api/Mastodon/Statuses/Unreblog.php
src/Module/Api/Mastodon/Timelines/Home.php
src/Module/Api/Mastodon/Timelines/ListTimeline.php
src/Module/Api/Mastodon/Timelines/PublicTimeline.php
src/Module/Api/Mastodon/Timelines/Tag.php
src/Module/Api/Mastodon/Trends/Statuses.php

index 0b9c2c554a49068c47a5587c183ce3b54c38b17a..ad2d9bab35ef616fcf0b21be6716988d6667c5e8 100644 (file)
@@ -79,15 +79,15 @@ class Status extends BaseFactory
        /**
         * @param int  $uriId           Uri-ID of the item
         * @param int  $uid             Item user
+        * @param bool $display_quote   Display quoted posts
         * @param bool $reblog          Check for reblogged post
         * @param bool $in_reply_status Add an "in_reply_status" element
-        * @param bool $display_quote   Display quoted posts
         *
         * @return \Friendica\Object\Api\Mastodon\Status
         * @throws HTTPException\InternalServerErrorException
         * @throws ImagickException|HTTPException\NotFoundException
         */
-       public function createFromUriId(int $uriId, int $uid = 0, bool $reblog = true, bool $in_reply_status = true, bool $display_quote = false): \Friendica\Object\Api\Mastodon\Status
+       public function createFromUriId(int $uriId, int $uid = 0, bool $display_quote = false, bool $reblog = true, bool $in_reply_status = true): \Friendica\Object\Api\Mastodon\Status
        {
                $fields = ['uri-id', 'uid', 'author-id', 'causer-id', 'author-uri-id', 'author-link', 'causer-uri-id', 'post-reason', 'starred', 'app', 'title', 'body', 'raw-body', 'content-warning', 'question-id',
                        'created', 'network', 'thr-parent-id', 'parent-author-id', 'language', 'uri', 'plink', 'private', 'vid', 'gravity', 'featured', 'has-media', 'quote-uri-id'];
@@ -249,13 +249,13 @@ class Status extends BaseFactory
                }
 
                if ($is_reshare) {
-                       $reshare = $this->createFromUriId($uriId, $uid, false, false)->toArray();
+                       $reshare = $this->createFromUriId($uriId, $uid, $display_quote, false, false)->toArray();
                } else {
                        $reshare = [];
                }
 
                if ($in_reply_status && ($item['gravity'] == Item::GRAVITY_COMMENT)) {
-                       $in_reply = $this->createFromUriId($item['thr-parent-id'], $uid, false, false)->toArray();
+                       $in_reply = $this->createFromUriId($item['thr-parent-id'], $uid, $display_quote, false, false)->toArray();
                } else {
                        $in_reply = [];
                }
@@ -283,7 +283,7 @@ class Status extends BaseFactory
                }
 
                if (!empty($quote_id)) {
-                       $quote = $this->createFromUriId($quote_id, $uid, false, false)->toArray();
+                       $quote = $this->createFromUriId($quote_id, $uid, false, false, false)->toArray();
                } else {
                        $quote = [];
                }
index 13f4aafd68b4606243dfbb551c65bf9cf37a4739..067e3302716e71b76289775466a3352a3c652dac 100644 (file)
@@ -119,7 +119,7 @@ class Statuses extends BaseApi
                while ($item = Post::fetch($items)) {
                        self::setBoundaries($item['uri-id']);
                        try {
-                               $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, true, true, $display_quotes);
+                               $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
                        } catch (\Throwable $th) {
                                Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]);
                        }
index b1e76f87f4dd7bcfd6dc127e11612967bf2f651f..411e8b1d06da927a15ce9da278dbf09eb383bd4b 100644 (file)
@@ -74,7 +74,7 @@ class Bookmarks extends BaseApi
                $statuses = [];
                while ($item = Post::fetch($items)) {
                        self::setBoundaries($item['uri-id']);
-                       $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, true, true, $display_quotes);
+                       $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
                }
                DBA::close($items);
 
index 82bf11ebf8794bf0f52e9319214e0c0fbb778898..dfbaa0ded55db6c0b375e2f9795dc427b1999ca9 100644 (file)
@@ -76,7 +76,7 @@ class Favourited extends BaseApi
                $statuses = [];
                while ($item = Post::fetch($items)) {
                        self::setBoundaries($item['thr-parent-id']);
-                       $statuses[] = DI::mstdnStatus()->createFromUriId($item['thr-parent-id'], $uid, true, true, $display_quotes);
+                       $statuses[] = DI::mstdnStatus()->createFromUriId($item['thr-parent-id'], $uid, $display_quotes);
                }
                DBA::close($items);
 
index 90bd50e6778d08135773887f3c5acf8d67b4967f..a991052c7fc5041b5fad91c2f64bb3a500781fde 100644 (file)
@@ -142,7 +142,7 @@ class Search extends BaseApi
                        // If the user-specific search failed, we search and probe a public post
                        $item_id = Item::fetchByLink($q, $uid) ?: Item::fetchByLink($q);
                        if ($item_id && $item = Post::selectFirst(['uri-id'], ['id' => $item_id])) {
-                               return DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, true, true, self::appSupportsQuotes());
+                               return DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, self::appSupportsQuotes());
                        }
                }
 
@@ -181,7 +181,7 @@ class Search extends BaseApi
                $statuses = [];
                while ($item = Post::fetch($items)) {
                        self::setBoundaries($item['uri-id']);
-                       $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, true, true, $display_quotes);
+                       $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
                }
                DBA::close($items);
 
index 993b827c3c9c7e935db5525d8232a684c4fe28b7..c803835d1d693b967d09c621419e6036bce00b2d 100644 (file)
@@ -88,7 +88,7 @@ class Statuses extends BaseApi
                Item::update($item, ['id' => $post['id']]);
                Item::updateDisplayCache($post['uri-id']);
 
-               System::jsonExit(DI::mstdnStatus()->createFromUriId($post['uri-id'], $uid, true, true, self::appSupportsQuotes()));
+               System::jsonExit(DI::mstdnStatus()->createFromUriId($post['uri-id'], $uid, self::appSupportsQuotes()));
        }
 
        protected function post(array $request = [])
@@ -269,7 +269,7 @@ class Statuses extends BaseApi
                if (!empty($id)) {
                        $item = Post::selectFirst(['uri-id'], ['id' => $id]);
                        if (!empty($item['uri-id'])) {
-                               System::jsonExit(DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, true, true, self::appSupportsQuotes()));
+                               System::jsonExit(DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, self::appSupportsQuotes()));
                        }
                }
 
@@ -308,7 +308,7 @@ class Statuses extends BaseApi
                        DI::mstdnError()->UnprocessableEntity();
                }
 
-               System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, false, true, self::appSupportsQuotes()));
+               System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes(), false));
        }
 
        private function getApp(): string
index b09a79afea0ac5f754b0bdabb64144d9f4395d68..b5e8a540d01d23e7b733c001bf41c934d32c18bf 100644 (file)
@@ -65,6 +65,6 @@ class Bookmark extends BaseApi
 
                Item::update(['starred' => true], ['id' => $item['id']]);
 
-               System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, true, true, self::appSupportsQuotes())->toArray());
+               System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray());
        }
 }
index 3fe3e5a4d2188de8ec823468448d5b6eb42b84c3..76677de4ad292825a66a0a8e3d2961b09bc3422c 100644 (file)
@@ -115,7 +115,7 @@ class Context extends BaseApi
                $display_quotes = self::appSupportsQuotes();
 
                foreach (array_slice($ancestors, 0, $request['limit']) as $ancestor) {
-                       $statuses['ancestors'][] = DI::mstdnStatus()->createFromUriId($ancestor, $uid, true, true, $display_quotes);;
+                       $statuses['ancestors'][] = DI::mstdnStatus()->createFromUriId($ancestor, $uid, $display_quotes);
                }
 
                $descendants = self::getChildren($id, $children);
@@ -123,7 +123,7 @@ class Context extends BaseApi
                asort($descendants);
 
                foreach (array_slice($descendants, 0, $request['limit']) as $descendant) {
-                       $statuses['descendants'][] = DI::mstdnStatus()->createFromUriId($descendant, $uid, true, true, $display_quotes);
+                       $statuses['descendants'][] = DI::mstdnStatus()->createFromUriId($descendant, $uid, $display_quotes);
                }
 
                System::jsonExit($statuses);
index 07e1771d9031184c12a3386393be75f6bd5f1a10..de4c0feec02e834fb0c92ef64a931b8340fee32b 100644 (file)
@@ -49,6 +49,6 @@ class Favourite extends BaseApi
 
                Item::performActivity($item['id'], 'like', $uid);
 
-               System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid,true, true, self::appSupportsQuotes())->toArray());
+               System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray());
        }
 }
index 29d6629612c9708aea178778ed1e2ad37c5438a9..fa6cd120e95f5f0464a0520d18709778d4cc1f0b 100644 (file)
@@ -53,6 +53,6 @@ class Mute extends BaseApi
 
                Post\ThreadUser::setIgnored($this->parameters['id'], $uid, true);
 
-               System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, true, true, self::appSupportsQuotes())->toArray());
+               System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray());
        }
 }
index 1ca588c1aa71ed71e8580079c1cfabeb580f7954..aa692c6b764c62045b883e0195f1233c789d8582 100644 (file)
@@ -48,6 +48,6 @@ class Pin extends BaseApi
 
                Post\Collection::add($this->parameters['id'], Post\Collection::FEATURED, $item['author-id'], $uid);
 
-               System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, true, true, self::appSupportsQuotes())->toArray());
+               System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray());
        }
 }
index b705f6d493d6fab14a6ba9d0e227a21aa265fd32..254144df98d5fedee27d63a2b0b92223237053b4 100644 (file)
@@ -58,6 +58,6 @@ class Reblog extends BaseApi
                        Item::performActivity($item['id'], 'announce', $uid);
                }
 
-               System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, true, true, self::appSupportsQuotes())->toArray());
+               System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray());
        }
 }
index acc64a8103b80fd770a5379688e5aada0a048100..dd6a59fed20390fcc27724838ec54923d7e22bdc 100644 (file)
@@ -65,6 +65,6 @@ class Unbookmark extends BaseApi
 
                Item::update(['starred' => false], ['id' => $item['id']]);
 
-               System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, true, true, self::appSupportsQuotes())->toArray());
+               System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray());
        }
 }
index f8a33319f173a2f61a892a3dcd3fd116b09f9e2d..06b5c6c615e2f15dd273bf72131f8688d8472622 100644 (file)
@@ -49,6 +49,6 @@ class Unfavourite extends BaseApi
 
                Item::performActivity($item['id'], 'unlike', $uid);
 
-               System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, true, true, self::appSupportsQuotes())->toArray());
+               System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray());
        }
 }
index 41b4cbd14ec02c06bbb5d53222c31dfbe1528358..658b6be8ba4a6ecd5d367442e6293e5d7d2ed7c9 100644 (file)
@@ -53,6 +53,6 @@ class Unmute extends BaseApi
 
                Post\ThreadUser::setIgnored($this->parameters['id'], $uid, false);
 
-               System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, true, true, self::appSupportsQuotes())->toArray());
+               System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray());
        }
 }
index 13c57158efcb7c9628d1478314b3e54a024c9ff7..f9efcdee66e71b146a1ed729628b273cdf3dfcf6 100644 (file)
@@ -48,6 +48,6 @@ class Unpin extends BaseApi
 
                Post\Collection::remove($this->parameters['id'], Post\Collection::FEATURED, $uid);
 
-               System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, true, true, self::appSupportsQuotes())->toArray());
+               System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray());
        }
 }
index 060d46bd864afa44323bde4e221b6337fca4be59..94de3e9c6ac5e4a6e5c28312c20fda4710c75c90 100644 (file)
@@ -64,6 +64,6 @@ class Unreblog extends BaseApi
                        Item::performActivity($item['id'], 'unannounce', $uid);
                }
 
-               System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, true, true, self::appSupportsQuotes())->toArray());
+               System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, self::appSupportsQuotes())->toArray());
        }
 }
index 5a9c26c603373569e75631ee7adfce851c0eeea4..a72957b9d8d4c5e7c1e8a0cbbcb01988393e143d 100644 (file)
@@ -96,7 +96,7 @@ class Home extends BaseApi
                $statuses = [];
                while ($item = Post::fetch($items)) {
                        self::setBoundaries($item['uri-id']);
-                       $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, true, true, $display_quotes);
+                       $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
                }
                DBA::close($items);
 
index a538a49f03b936c3701c702c955df15f417972e7..83ab204e7b83654ea52a989afc414e37be2fc770 100644 (file)
@@ -101,7 +101,7 @@ class ListTimeline extends BaseApi
                $statuses = [];
                while ($item = Post::fetch($items)) {
                        self::setBoundaries($item['uri-id']);
-                       $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, true, true, $display_quotes);
+                       $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
                }
                DBA::close($items);
 
index fe3fda82c6feeb7d6f908e442bc814b42f2ec8af..083d9867ed524cb08d47f9de0261896d673271d1 100644 (file)
@@ -103,7 +103,7 @@ class PublicTimeline extends BaseApi
                while ($item = Post::fetch($items)) {
                        self::setBoundaries($item['uri-id']);
                        try {
-                               $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, true, true, $display_quotes);
+                               $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
                        } catch (\Throwable $th) {
                                Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]);
                        }
index 75df46259505197a512d8b3a4255ad713b1f3911..c5a06e28c23593eeb8272433e881fbf4b235564e 100644 (file)
@@ -110,7 +110,7 @@ class Tag extends BaseApi
                $statuses = [];
                while ($item = Post::fetch($items)) {
                        self::setBoundaries($item['uri-id']);
-                       $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, true, true, $display_quotes);
+                       $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, $display_quotes);
                }
                DBA::close($items);
 
index 2b323b80626d8872acfa9598d61287bf55db583d..7fad480cb05e644074aed4772c97d78bd1bf95c3 100644 (file)
@@ -53,7 +53,7 @@ class Statuses extends BaseApi
                $trending = [];
                $statuses = Post::selectPostThread(['uri-id'], $condition, ['limit' => $request['limit'], 'order' => ['total-actors' => true]]);
                while ($status = Post::fetch($statuses)) {
-                       $trending[] = DI::mstdnStatus()->createFromUriId($status['uri-id'], $uid, true, true, $display_quotes);
+                       $trending[] = DI::mstdnStatus()->createFromUriId($status['uri-id'], $uid, $display_quotes);
                }
                DBA::close($statuses);