]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Notifications/Introductions.php
Allow the search for contacts on blocked servers via web
[friendica.git] / src / Module / Notifications / Introductions.php
index b9bbd0be93159677cd2d1a10ecdbe39cb60fdb9d..246bed54029d54f616e633de48d1ecc721a18aca 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -21,6 +21,7 @@
 
 namespace Friendica\Module\Notifications;
 
+use Friendica\App;
 use Friendica\App\Arguments;
 use Friendica\App\Mode;
 use Friendica\Content\ContactSelector;
@@ -29,10 +30,15 @@ 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;
+use Psr\Log\LoggerInterface;
 
 /**
  * Prints notifications about introduction
@@ -44,9 +50,9 @@ class Introductions extends BaseNotifications
        /** @var Mode */
        protected $mode;
 
-       public function __construct(Mode $mode, IntroductionFactory $notificationIntro, Arguments $args, L10n $l10n, 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($args, $l10n, $parameters);
+               parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $userSession, $server, $parameters);
 
                $this->notificationIntro = $notificationIntro;
                $this->mode              = $mode;
@@ -71,7 +77,7 @@ class Introductions extends BaseNotifications
                ];
        }
 
-       public function content(): string
+       protected function content(array $request = []): string
        {
                Nav::setSelected('introductions');
 
@@ -93,8 +99,8 @@ 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
                /** @var Introduction $Introduction */
@@ -122,7 +128,7 @@ class Introductions extends BaseNotifications
                                                '$zrl'                   => $Introduction->getZrl(),
                                                '$lbl_url'               => $this->t('Profile URL'),
                                                '$addr'                  => $Introduction->getAddr(),
-                                               '$action'                => 'follow',
+                                               '$action'                => 'contact/follow',
                                                '$approve'               => $this->t('Approve'),
                                                '$note'                  => $Introduction->getNote(),
                                                '$ignore'                => $this->t('Ignore'),
@@ -146,7 +152,7 @@ class Introductions extends BaseNotifications
                                        $helptext  = $this->t('Shall your connection be bidirectional or not?');
                                        $helptext2 = $this->t('Accepting %s as a friend allows %s to subscribe to your posts, and you will also receive updates from them in your news feed.', $convertedName, $convertedName);
                                        $helptext3 = $this->t('Accepting %s as a subscriber allows them to subscribe to your posts, but you will not receive updates from them in your news feed.', $convertedName);
-               
+
                                        $friend = ['duplex', $this->t('Friend'), '1', $helptext2, true];
                                        $follower = ['duplex', $this->t('Subscriber'), '0', $helptext3, false];
 
@@ -207,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']);
                }