From: Michael Date: Wed, 25 Jan 2023 06:26:17 +0000 (+0000) Subject: API: added positiv list for quote support X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=49d513f8d2ee7fd4a9a762d03d42f6ce4b7f16e3;p=friendica.git API: added positiv list for quote support --- diff --git a/src/Factory/Api/Mastodon/Status.php b/src/Factory/Api/Mastodon/Status.php index 1b569d57e5..c120825fd1 100644 --- a/src/Factory/Api/Mastodon/Status.php +++ b/src/Factory/Api/Mastodon/Status.php @@ -198,33 +198,6 @@ class Status extends BaseFactory $poll = null; } - $shared = $this->contentItem->getSharedPost($item, ['uri-id']); - if (!empty($shared)) { - $shared_uri_id = $shared['post']['uri-id']; - - foreach ($this->mstdnMentionFactory->createFromUriId($shared_uri_id)->getArrayCopy() as $mention) { - if (!in_array($mention, $mentions)) { - $mentions[] = $mention; - } - } - - foreach ($this->mstdnTagFactory->createFromUriId($shared_uri_id) as $tag) { - if (!in_array($tag, $tags)) { - $tags[] = $tag; - } - } - - foreach ($this->mstdnAttachementFactory->createFromUriId($shared_uri_id) as $attachment) { - if (!in_array($attachment, $attachments)) { - $attachments[] = $attachment; - } - } - - if (empty($card->toArray())) { - $card = $this->mstdnCardFactory->createFromUriId($shared_uri_id); - } - } - if ($display_quote) { $quote = self::createQuote($item, $uid); @@ -239,6 +212,33 @@ class Status extends BaseFactory $quote = self::createQuote($item, $uid); } + $shared = $this->contentItem->getSharedPost($item, ['uri-id']); + if (!empty($shared)) { + $shared_uri_id = $shared['post']['uri-id']; + + foreach ($this->mstdnMentionFactory->createFromUriId($shared_uri_id)->getArrayCopy() as $mention) { + if (!in_array($mention, $mentions)) { + $mentions[] = $mention; + } + } + + foreach ($this->mstdnTagFactory->createFromUriId($shared_uri_id) as $tag) { + if (!in_array($tag, $tags)) { + $tags[] = $tag; + } + } + + foreach ($this->mstdnAttachementFactory->createFromUriId($shared_uri_id) as $attachment) { + if (!in_array($attachment, $attachments)) { + $attachments[] = $attachment; + } + } + + if (empty($card->toArray())) { + $card = $this->mstdnCardFactory->createFromUriId($shared_uri_id); + } + } + $item['body'] = $this->contentItem->addSharedPost($item); if (!is_null($item['raw-body'])) { diff --git a/src/Module/Api/Mastodon/Accounts/Statuses.php b/src/Module/Api/Mastodon/Accounts/Statuses.php index 6b1a64a5de..13f4aafd68 100644 --- a/src/Module/Api/Mastodon/Accounts/Statuses.php +++ b/src/Module/Api/Mastodon/Accounts/Statuses.php @@ -113,11 +113,13 @@ class Statuses extends BaseApi $items = Post::selectForUser($uid, ['uri-id'], $condition, $params); } + $display_quotes = self::appSupportsQuotes(); + $statuses = []; while ($item = Post::fetch($items)) { self::setBoundaries($item['uri-id']); try { - $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid); + $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, true, true, $display_quotes); } catch (\Throwable $th) { Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]); } diff --git a/src/Module/Api/Mastodon/Bookmarks.php b/src/Module/Api/Mastodon/Bookmarks.php index b027836ef4..b1e76f87f4 100644 --- a/src/Module/Api/Mastodon/Bookmarks.php +++ b/src/Module/Api/Mastodon/Bookmarks.php @@ -69,10 +69,12 @@ class Bookmarks extends BaseApi $items = Post::selectThreadForUser($uid, ['uri-id'], $condition, $params); + $display_quotes = self::appSupportsQuotes(); + $statuses = []; while ($item = Post::fetch($items)) { self::setBoundaries($item['uri-id']); - $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid); + $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, true, true, $display_quotes); } DBA::close($items); diff --git a/src/Module/Api/Mastodon/Favourited.php b/src/Module/Api/Mastodon/Favourited.php index 941c4a5530..82bf11ebf8 100644 --- a/src/Module/Api/Mastodon/Favourited.php +++ b/src/Module/Api/Mastodon/Favourited.php @@ -45,8 +45,9 @@ class Favourited extends BaseApi $request = $this->getRequest([ 'limit' => 20, // Maximum number of results to return. Defaults to 20. - 'min_id' => 0, // Return results immediately newer than id 'max_id' => 0, // Return results older than id + 'since_id' => 0, // Return results newer than this ID. Use HTTP Link header to paginate. + 'min_id' => 0, // Return results immediately newer than id 'with_muted' => false, // Pleroma extension: return activities by muted (not by blocked!) users. ], $request); @@ -58,6 +59,10 @@ class Favourited extends BaseApi $condition = DBA::mergeConditions($condition, ["`thr-parent-id` < ?", $request['max_id']]); } + if (!empty($request['since_id'])) { + $condition = DBA::mergeConditions($condition, ["`thr-parent-id` > ?", $request['since_id']]); + } + if (!empty($request['min_id'])) { $condition = DBA::mergeConditions($condition, ["`thr-parent-id` > ?", $request['min_id']]); @@ -66,10 +71,12 @@ class Favourited extends BaseApi $items = Post::selectForUser($uid, ['thr-parent-id'], $condition, $params); + $display_quotes = self::appSupportsQuotes(); + $statuses = []; while ($item = Post::fetch($items)) { self::setBoundaries($item['thr-parent-id']); - $statuses[] = DI::mstdnStatus()->createFromUriId($item['thr-parent-id'], $uid); + $statuses[] = DI::mstdnStatus()->createFromUriId($item['thr-parent-id'], $uid, true, true, $display_quotes); } DBA::close($items); diff --git a/src/Module/Api/Mastodon/Search.php b/src/Module/Api/Mastodon/Search.php index 72500cb628..90bd50e677 100644 --- a/src/Module/Api/Mastodon/Search.php +++ b/src/Module/Api/Mastodon/Search.php @@ -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); + return DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, true, true, self::appSupportsQuotes()); } } @@ -176,10 +176,12 @@ class Search extends BaseApi $items = DBA::select($table, ['uri-id'], $condition, $params); + $display_quotes = self::appSupportsQuotes(); + $statuses = []; while ($item = Post::fetch($items)) { self::setBoundaries($item['uri-id']); - $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid); + $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, true, true, $display_quotes); } DBA::close($items); diff --git a/src/Module/Api/Mastodon/Statuses.php b/src/Module/Api/Mastodon/Statuses.php index 7419cccb38..993b827c3c 100644 --- a/src/Module/Api/Mastodon/Statuses.php +++ b/src/Module/Api/Mastodon/Statuses.php @@ -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)); + System::jsonExit(DI::mstdnStatus()->createFromUriId($post['uri-id'], $uid, true, true, 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)); + System::jsonExit(DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, true, true, self::appSupportsQuotes())); } } @@ -308,7 +308,7 @@ class Statuses extends BaseApi DI::mstdnError()->UnprocessableEntity(); } - System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, false)); + System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, false, true, self::appSupportsQuotes())); } private function getApp(): string diff --git a/src/Module/Api/Mastodon/Statuses/Bookmark.php b/src/Module/Api/Mastodon/Statuses/Bookmark.php index 7696995596..b09a79afea 100644 --- a/src/Module/Api/Mastodon/Statuses/Bookmark.php +++ b/src/Module/Api/Mastodon/Statuses/Bookmark.php @@ -65,6 +65,6 @@ class Bookmark extends BaseApi Item::update(['starred' => true], ['id' => $item['id']]); - System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid)->toArray()); + System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, true, true, self::appSupportsQuotes())->toArray()); } } diff --git a/src/Module/Api/Mastodon/Statuses/Context.php b/src/Module/Api/Mastodon/Statuses/Context.php index c18a003d56..3fe3e5a4d2 100644 --- a/src/Module/Api/Mastodon/Statuses/Context.php +++ b/src/Module/Api/Mastodon/Statuses/Context.php @@ -45,6 +45,9 @@ class Context extends BaseApi } $request = $this->getRequest([ + 'max_id' => 0, // Return results older than this id + 'since_id' => 0, // Return results newer than this id + 'min_id' => 0, // Return results immediately newer than this id 'limit' => 40, // Maximum number of results to return. Defaults to 40. ], $request); @@ -55,17 +58,36 @@ class Context extends BaseApi $parent = Post::selectFirst(['parent-uri-id'], ['uri-id' => $id]); if (DBA::isResult($parent)) { - $posts = Post::selectPosts(['uri-id', 'thr-parent-id'], - ['parent-uri-id' => $parent['parent-uri-id'], 'gravity' => [Item::GRAVITY_PARENT, Item::GRAVITY_COMMENT]]); + $params = ['order' => ['uri-id' => true]]; + $condition = ['parent-uri-id' => $parent['parent-uri-id'], 'gravity' => [Item::GRAVITY_PARENT, Item::GRAVITY_COMMENT]]; + + if (!empty($request['max_id'])) { + $condition = DBA::mergeConditions($condition, ["`uri-id` < ?", $request['max_id']]); + } + + if (!empty($request['since_id'])) { + $condition = DBA::mergeConditions($condition, ["`uri-id` > ?", $request['since_id']]); + } + + if (!empty($request['min_id'])) { + $condition = DBA::mergeConditions($condition, ["`uri-id` > ?", $request['min_id']]); + $params['order'] = ['uri-id']; + } + + $posts = Post::selectPosts(['uri-id', 'thr-parent-id'], $condition, $params); while ($post = Post::fetch($posts)) { if ($post['uri-id'] == $post['thr-parent-id']) { continue; } + self::setBoundaries($post['uri-id']); + $parents[$post['uri-id']] = $post['thr-parent-id']; $children[$post['thr-parent-id']][] = $post['uri-id']; } DBA::close($posts); + + self::setLinkHeader(); } else { $parent = DBA::selectFirst('mail', ['parent-uri-id'], ['uri-id' => $id, 'uid' => $uid]); if (DBA::isResult($parent)) { @@ -90,8 +112,10 @@ class Context extends BaseApi asort($ancestors); + $display_quotes = self::appSupportsQuotes(); + foreach (array_slice($ancestors, 0, $request['limit']) as $ancestor) { - $statuses['ancestors'][] = DI::mstdnStatus()->createFromUriId($ancestor, $uid);; + $statuses['ancestors'][] = DI::mstdnStatus()->createFromUriId($ancestor, $uid, true, true, $display_quotes);; } $descendants = self::getChildren($id, $children); @@ -99,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); + $statuses['descendants'][] = DI::mstdnStatus()->createFromUriId($descendant, $uid, true, true, $display_quotes); } System::jsonExit($statuses); diff --git a/src/Module/Api/Mastodon/Statuses/Favourite.php b/src/Module/Api/Mastodon/Statuses/Favourite.php index ed23891f02..07e1771d90 100644 --- a/src/Module/Api/Mastodon/Statuses/Favourite.php +++ b/src/Module/Api/Mastodon/Statuses/Favourite.php @@ -49,6 +49,6 @@ class Favourite extends BaseApi Item::performActivity($item['id'], 'like', $uid); - System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid)->toArray()); + System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid,true, true, self::appSupportsQuotes())->toArray()); } } diff --git a/src/Module/Api/Mastodon/Statuses/Mute.php b/src/Module/Api/Mastodon/Statuses/Mute.php index f00a7b6d5b..29d6629612 100644 --- a/src/Module/Api/Mastodon/Statuses/Mute.php +++ b/src/Module/Api/Mastodon/Statuses/Mute.php @@ -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)->toArray()); + System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, true, true, self::appSupportsQuotes())->toArray()); } } diff --git a/src/Module/Api/Mastodon/Statuses/Pin.php b/src/Module/Api/Mastodon/Statuses/Pin.php index b5eb619d1e..1ca588c1aa 100644 --- a/src/Module/Api/Mastodon/Statuses/Pin.php +++ b/src/Module/Api/Mastodon/Statuses/Pin.php @@ -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)->toArray()); + System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, true, true, self::appSupportsQuotes())->toArray()); } } diff --git a/src/Module/Api/Mastodon/Statuses/Reblog.php b/src/Module/Api/Mastodon/Statuses/Reblog.php index 631f3e8fe1..b705f6d493 100644 --- a/src/Module/Api/Mastodon/Statuses/Reblog.php +++ b/src/Module/Api/Mastodon/Statuses/Reblog.php @@ -58,6 +58,6 @@ class Reblog extends BaseApi Item::performActivity($item['id'], 'announce', $uid); } - System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid)->toArray()); + System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, true, true, self::appSupportsQuotes())->toArray()); } } diff --git a/src/Module/Api/Mastodon/Statuses/Unbookmark.php b/src/Module/Api/Mastodon/Statuses/Unbookmark.php index d49a661367..acc64a8103 100644 --- a/src/Module/Api/Mastodon/Statuses/Unbookmark.php +++ b/src/Module/Api/Mastodon/Statuses/Unbookmark.php @@ -65,6 +65,6 @@ class Unbookmark extends BaseApi Item::update(['starred' => false], ['id' => $item['id']]); - System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid)->toArray()); + System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, true, true, self::appSupportsQuotes())->toArray()); } } diff --git a/src/Module/Api/Mastodon/Statuses/Unfavourite.php b/src/Module/Api/Mastodon/Statuses/Unfavourite.php index a096ed7d6a..f8a33319f1 100644 --- a/src/Module/Api/Mastodon/Statuses/Unfavourite.php +++ b/src/Module/Api/Mastodon/Statuses/Unfavourite.php @@ -49,6 +49,6 @@ class Unfavourite extends BaseApi Item::performActivity($item['id'], 'unlike', $uid); - System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid)->toArray()); + System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, true, true, self::appSupportsQuotes())->toArray()); } } diff --git a/src/Module/Api/Mastodon/Statuses/Unmute.php b/src/Module/Api/Mastodon/Statuses/Unmute.php index ed700eeb01..41b4cbd14e 100644 --- a/src/Module/Api/Mastodon/Statuses/Unmute.php +++ b/src/Module/Api/Mastodon/Statuses/Unmute.php @@ -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)->toArray()); + System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, true, true, self::appSupportsQuotes())->toArray()); } } diff --git a/src/Module/Api/Mastodon/Statuses/Unpin.php b/src/Module/Api/Mastodon/Statuses/Unpin.php index 61df4a2dbb..13c57158ef 100644 --- a/src/Module/Api/Mastodon/Statuses/Unpin.php +++ b/src/Module/Api/Mastodon/Statuses/Unpin.php @@ -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)->toArray()); + System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, true, true, self::appSupportsQuotes())->toArray()); } } diff --git a/src/Module/Api/Mastodon/Statuses/Unreblog.php b/src/Module/Api/Mastodon/Statuses/Unreblog.php index d9c21be373..060d46bd86 100644 --- a/src/Module/Api/Mastodon/Statuses/Unreblog.php +++ b/src/Module/Api/Mastodon/Statuses/Unreblog.php @@ -64,6 +64,6 @@ class Unreblog extends BaseApi Item::performActivity($item['id'], 'unannounce', $uid); } - System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid)->toArray()); + System::jsonExit(DI::mstdnStatus()->createFromUriId($this->parameters['id'], $uid, true, true, self::appSupportsQuotes())->toArray()); } } diff --git a/src/Module/Api/Mastodon/Timelines/Home.php b/src/Module/Api/Mastodon/Timelines/Home.php index a9a01a813c..8894f0979a 100644 --- a/src/Module/Api/Mastodon/Timelines/Home.php +++ b/src/Module/Api/Mastodon/Timelines/Home.php @@ -21,6 +21,7 @@ namespace Friendica\Module\Api\Mastodon\Timelines; +use Friendica\Core\Logger; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\DI; @@ -91,10 +92,12 @@ class Home extends BaseApi $items = Post::selectForUser($uid, ['uri-id'], $condition, $params); + $display_quotes = self::appSupportsQuotes(); + $statuses = []; while ($item = Post::fetch($items)) { self::setBoundaries($item['uri-id']); - $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid); + $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, true, true, $display_quotes); } DBA::close($items); diff --git a/src/Module/Api/Mastodon/Timelines/ListTimeline.php b/src/Module/Api/Mastodon/Timelines/ListTimeline.php index dbfa277f72..a538a49f03 100644 --- a/src/Module/Api/Mastodon/Timelines/ListTimeline.php +++ b/src/Module/Api/Mastodon/Timelines/ListTimeline.php @@ -96,10 +96,12 @@ class ListTimeline extends BaseApi $items = Post::selectForUser($uid, ['uri-id'], $condition, $params); + $display_quotes = self::appSupportsQuotes(); + $statuses = []; while ($item = Post::fetch($items)) { self::setBoundaries($item['uri-id']); - $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid); + $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, true, true, $display_quotes); } DBA::close($items); diff --git a/src/Module/Api/Mastodon/Timelines/PublicTimeline.php b/src/Module/Api/Mastodon/Timelines/PublicTimeline.php index 9aeb54e084..fe3fda82c6 100644 --- a/src/Module/Api/Mastodon/Timelines/PublicTimeline.php +++ b/src/Module/Api/Mastodon/Timelines/PublicTimeline.php @@ -97,11 +97,13 @@ class PublicTimeline extends BaseApi $items = Post::selectPostsForUser($uid, ['uri-id'], $condition, $params); + $display_quotes = self::appSupportsQuotes(); + $statuses = []; while ($item = Post::fetch($items)) { self::setBoundaries($item['uri-id']); try { - $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid); + $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, true, true, $display_quotes); } catch (\Throwable $th) { Logger::info('Post not fetchable', ['uri-id' => $item['uri-id'], 'uid' => $uid, 'error' => $th]); } diff --git a/src/Module/Api/Mastodon/Timelines/Tag.php b/src/Module/Api/Mastodon/Timelines/Tag.php index dea8aee5af..75df462595 100644 --- a/src/Module/Api/Mastodon/Timelines/Tag.php +++ b/src/Module/Api/Mastodon/Timelines/Tag.php @@ -105,10 +105,12 @@ class Tag extends BaseApi $items = DBA::select('tag-search-view', ['uri-id'], $condition, $params); + $display_quotes = self::appSupportsQuotes(); + $statuses = []; while ($item = Post::fetch($items)) { self::setBoundaries($item['uri-id']); - $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid); + $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid, true, true, $display_quotes); } DBA::close($items); diff --git a/src/Module/Api/Mastodon/Trends/Statuses.php b/src/Module/Api/Mastodon/Trends/Statuses.php index f9411465c6..2b323b8062 100644 --- a/src/Module/Api/Mastodon/Trends/Statuses.php +++ b/src/Module/Api/Mastodon/Trends/Statuses.php @@ -48,10 +48,12 @@ class Statuses extends BaseApi $condition = ["NOT `private` AND `commented` > ? AND `created` > ?", DateTimeFormat::utc('now -1 day'), DateTimeFormat::utc('now -1 week')]; $condition = DBA::mergeConditions($condition, ['network' => Protocol::FEDERATED]); + $display_quotes = self::appSupportsQuotes(); + $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); + $trending[] = DI::mstdnStatus()->createFromUriId($status['uri-id'], $uid, true, true, $display_quotes); } DBA::close($statuses); diff --git a/src/Module/BaseApi.php b/src/Module/BaseApi.php index 29ca755e05..6a41198473 100644 --- a/src/Module/BaseApi.php +++ b/src/Module/BaseApi.php @@ -180,6 +180,17 @@ class BaseApi extends BaseModule } } + /** + * Check if the app is known to support quoted posts + * + * @return bool + */ + public static function appSupportsQuotes(): bool + { + $token = self::getCurrentApplication(); + return (!empty($token['name']) && in_array($token['name'], ['Fedilab'])); + } + /** * Get current application token *