]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Api/Mastodon/Tags/Unfollow.php
Issue 12191: We can now follow and unfollow tags via API
[friendica.git] / src / Module / Api / Mastodon / Tags / Unfollow.php
index a20b824b8d3547a2dfbe70a1e53eabbf21c1c50e..465c1974b59452cf7a7a00aa89f630fad7a69d33 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,11 @@ class Unfollow extends BaseApi
                        DI::mstdnError()->UnprocessableEntity();
                }
 
-               $this->response->unsupported(Router::POST, $request);
+               $term = ['uid' => $uid, 'term' => '#' . $this->parameters['hashtag']];
+
+               DBA::delete('search', $term);
+
+               $hashtag  = new \Friendica\Object\Api\Mastodon\Tag($this->baseUrl, $term, [], false);
+               System::jsonExit($hashtag->toArray());
        }
 }