]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Filer/RemoveTag.php
Improved asynchronous message procession
[friendica.git] / src / Module / Filer / RemoveTag.php
index b940e69837407700ca71f43ebae2703f1042bcaf..23486fcf098dd30c66d13f69437bdc9479945050 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
  *
@@ -24,7 +24,7 @@ namespace Friendica\Module\Filer;
 use Friendica\App;
 use Friendica\BaseModule;
 use Friendica\Core\L10n;
-use Friendica\Core\Session;
+use Friendica\Core\Session\Capability\IHandleUserSessions;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
 use Friendica\Model\Post;
@@ -41,22 +41,25 @@ class RemoveTag extends BaseModule
 {
        /** @var SystemMessages */
        private $systemMessages;
+       /** @var IHandleUserSessions */
+       private $userSession;
 
-       public function __construct(SystemMessages $systemMessages, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
+       public function __construct(SystemMessages $systemMessages, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, IHandleUserSessions $userSession, array $server, array $parameters = [])
        {
                parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
                $this->systemMessages = $systemMessages;
+               $this->userSession    = $userSession;
        }
 
        protected function post(array $request = [])
        {
-               System::httpError($this->removeTag($request));
+               $this->httpError($this->removeTag($request));
        }
 
        protected function content(array $request = []): string
        {
-               if (!Session::getLocalUser()) {
+               if (!$this->userSession->getLocalUserId()) {
                        throw new HTTPException\ForbiddenException();
                }
 
@@ -108,7 +111,7 @@ class RemoveTag extends BaseModule
                        return 404;
                }
 
-               if (!Post\Category::deleteFileByURIId($item['uri-id'], Session::getLocalUser(), $type, $term)) {
+               if (!Post\Category::deleteFileByURIId($item['uri-id'], $this->userSession->getLocalUserId(), $type, $term)) {
                        $this->systemMessages->addNotice($this->l10n->t('Item was not removed'));
                        return 500;
                }