]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Notifications/Introductions.php
Merge pull request #12050 from nupplaphil/bug/notf_session_fix
[friendica.git] / src / Module / Notifications / Introductions.php
index 10d2bbb9fcdd0516d2f7492e58cf779b09d64a85..2bd03e3071784772e472d950ad7a5af115d1003d 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -30,8 +30,11 @@ use Friendica\Content\Text\BBCode;
 use Friendica\Core\L10n;
 use Friendica\Core\Protocol;
 use Friendica\Core\Renderer;
+use Friendica\Core\Session\Capability\IHandleUserSessions;
+use Friendica\DI;
 use Friendica\Model\User;
 use Friendica\Module\BaseNotifications;
+use Friendica\Module\Response;
 use Friendica\Navigation\Notifications\Factory\Introduction as IntroductionFactory;
 use Friendica\Navigation\Notifications\ValueObject\Introduction;
 use Friendica\Util\Profiler;
@@ -47,9 +50,9 @@ class Introductions extends BaseNotifications
        /** @var Mode */
        protected $mode;
 
-       public function __construct(L10n $l10n, App\BaseURL $baseUrl, Arguments $args, LoggerInterface $logger, Profiler $profiler, Mode $mode, IntroductionFactory $notificationIntro, array $server, array $parameters = [])
+       public function __construct(L10n $l10n, App\BaseURL $baseUrl, Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, Mode $mode, IntroductionFactory $notificationIntro, IHandleUserSessions $userSession, array $server, array $parameters = [])
        {
-               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $server, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $userSession, $server, $parameters);
 
                $this->notificationIntro = $notificationIntro;
                $this->mode              = $mode;
@@ -96,7 +99,7 @@ class Introductions extends BaseNotifications
                        'text' => (!$all ? $this->t('Show Ignored Requests') : $this->t('Hide Ignored Requests')),
                ];
 
-               $owner = User::getOwnerDataById(local_user());
+               $owner = User::getOwnerDataById(DI::userSession()->getLocalUserId());
        
                // Loop through all introduction notifications.This creates an array with the output html for each
                // introduction
@@ -210,7 +213,7 @@ class Introductions extends BaseNotifications
                }
 
                if (count($notifications['notifications']) == 0) {
-                       notice($this->t('No introductions.'));
+                       DI::sysmsg()->addNotice($this->t('No introductions.'));
                        $notificationNoContent = $this->t('No more %s notifications.', $notifications['ident']);
                }