]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Api/Mastodon/Tags.php
Merge pull request #13176 from MrPetovan/bug/warnings
[friendica.git] / src / Module / Api / Mastodon / Tags.php
index 97631b506aa8cf47a0f5a8a3b32d559f0a29e074..229fd8e005cd3fb96e656b48b19b1ecdb976cf6c 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -21,8 +21,8 @@
 
 namespace Friendica\Module\Api\Mastodon;
 
-use Friendica\App\Router;
-use Friendica\Core\Logger;
+use Friendica\Core\System;
+use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Module\BaseApi;
 
@@ -43,6 +43,10 @@ class Tags extends BaseApi
                        DI::mstdnError()->UnprocessableEntity();
                }
 
-               $this->response->unsupported(Router::GET, $request);
+               $tag       = ltrim($this->parameters['hashtag'], '#');
+               $following = DBA::exists('search', ['uid' => $uid, 'term' => '#' . $tag]);
+
+               $hashtag = new \Friendica\Object\Api\Mastodon\Tag($this->baseUrl, ['name' => $tag], [], $following);
+               System::jsonExit($hashtag->toArray());
        }
 }