]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Api/Mastodon/Tags/Follow.php
Trim the tag
[friendica.git] / src / Module / Api / Mastodon / Tags / Follow.php
index 9a813f7257038b9178ab622e979c1c5d1964e846..767245b60f49ce087bdace646764d601cc607c66 100644 (file)
@@ -21,7 +21,8 @@
 
 namespace Friendica\Module\Api\Mastodon\Tags;
 
-use Friendica\App\Router;
+use Friendica\Core\System;
+use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Module\BaseApi;
 
@@ -39,6 +40,12 @@ class Follow extends BaseApi
                        DI::mstdnError()->UnprocessableEntity();
                }
 
-               $this->response->unsupported(Router::POST, $request);
+               $fields = ['uid' => $uid, 'term' => '#' . ltrim($this->parameters['hashtag'], '#')];
+               if (!DBA::exists('search', $fields)) {
+                       DBA::insert('search', $fields);
+               }
+
+               $hashtag  = new \Friendica\Object\Api\Mastodon\Tag($this->baseUrl, $fields, [], true);
+               System::jsonExit($hashtag->toArray());
        }
 }