]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Api/Mastodon/Tags/Unfollow.php
Merge branch '2023.03-rc' into stable
[friendica.git] / src / Module / Api / Mastodon / Tags / Unfollow.php
index a20b824b8d3547a2dfbe70a1e53eabbf21c1c50e..06b08b7c3d1130bb80a048a1977d312bfcae2263 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,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' => '#' . ltrim($this->parameters['hashtag'], '#')];
+
+               DBA::delete('search', $term);
+
+               $hashtag = new \Friendica\Object\Api\Mastodon\Tag($this->baseUrl, ['name' => ltrim($this->parameters['hashtag'])], [], false);
+               System::jsonExit($hashtag->toArray());
        }
 }