]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Item/Ignore.php
Merge remote-tracking branch 'upstream/develop' into inbox-gsid
[friendica.git] / src / Module / Item / Ignore.php
index 626d6bb508fad6083dbde827d964a1931ab0f495..4950ba069d767728bf25ed429f1163f4bde435c8 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
  *
@@ -22,9 +22,9 @@
 namespace Friendica\Module\Item;
 
 use Friendica\BaseModule;
-use Friendica\Core\Session;
 use Friendica\Core\System;
 use Friendica\DI;
+use Friendica\Model\Item;
 use Friendica\Model\Post;
 use Friendica\Network\HTTPException;
 
@@ -37,7 +37,7 @@ class Ignore extends BaseModule
        {
                $l10n = DI::l10n();
 
-               if (!Session::isAuthenticated()) {
+               if (!DI::userSession()->isAuthenticated()) {
                        throw new HttpException\ForbiddenException($l10n->t('Access denied.'));
                }
 
@@ -49,15 +49,15 @@ class Ignore extends BaseModule
 
                $dba = DI::dba();
 
-               $thread = Post::selectFirst(['uri-id', 'uid'], ['id' => $itemId, 'gravity' => GRAVITY_PARENT]);
+               $thread = Post::selectFirst(['uri-id', 'uid'], ['id' => $itemId, 'gravity' => Item::GRAVITY_PARENT]);
                if (!$dba->isResult($thread)) {
                        throw new HTTPException\NotFoundException();
                }
 
-               $ignored = !Post\ThreadUser::getIgnored($thread['uri-id'], local_user());
+               $ignored = !Post\ThreadUser::getIgnored($thread['uri-id'], DI::userSession()->getLocalUserId());
 
-               if (in_array($thread['uid'], [0, local_user()])) {
-                       Post\ThreadUser::setIgnored($thread['uri-id'], local_user(), $ignored);
+               if (in_array($thread['uid'], [0, DI::userSession()->getLocalUserId()])) {
+                       Post\ThreadUser::setIgnored($thread['uri-id'], DI::userSession()->getLocalUserId(), $ignored);
                } else {
                        throw new HTTPException\BadRequestException();
                }