X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FContact%2FConversations.php;h=838e499ccbaaf7fa94e7b3a08d65e7dc755471a4;hb=79235b6db1c9badd6c9602d54ad0d550e4bec2fd;hp=0915a4bd21d63ce251ffb05fdcfd4144b49dc48f;hpb=e56a53647bd5469551bf4f9ef2df50a5dd16b943;p=friendica.git diff --git a/src/Module/Contact/Conversations.php b/src/Module/Contact/Conversations.php index 0915a4bd21..838e499ccb 100644 --- a/src/Module/Contact/Conversations.php +++ b/src/Module/Contact/Conversations.php @@ -2,7 +2,7 @@ /** * @copyright Copyright (C) 2010-2022, the Friendica project * - * @license GNU AGPL version 3 or any later version + * @license GNU AGPL version 3 or any later version * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -29,6 +29,7 @@ use Friendica\Content\Nav; use Friendica\Content\Widget; use Friendica\Core\L10n; use Friendica\Core\Protocol; +use Friendica\Core\Session\Capability\IHandleUserSessions; use Friendica\Core\Theme; use Friendica\Model; use Friendica\Module\Contact; @@ -55,25 +56,30 @@ class Conversations extends BaseModule * @var LocalRelationship */ private $localRelationship; + /** + * @var IHandleUserSessions + */ + private $userSession; - public function __construct(L10n $l10n, LocalRelationship $localRelationship, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, App\Page $page, Conversation $conversation, array $server, array $parameters = []) + public function __construct(L10n $l10n, LocalRelationship $localRelationship, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, App\Page $page, Conversation $conversation, IHandleUserSessions $userSession, $server, array $parameters = []) { parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters); $this->page = $page; $this->conversation = $conversation; $this->localRelationship = $localRelationship; + $this->userSession = $userSession; } protected function content(array $request = []): string { - if (!local_user()) { + if (!$this->userSession->getLocalUserId()) { return Login::form($_SERVER['REQUEST_URI']); } // Backward compatibility: Ensure to use the public contact when the user contact is provided // Remove by version 2022.03 - $data = Model\Contact::getPublicAndUserContactID(intval($this->parameters['id']), local_user()); + $data = Model\Contact::getPublicAndUserContactID(intval($this->parameters['id']), $this->userSession->getLocalUserId()); if (empty($data)) { throw new NotFoundException($this->t('Contact not found.')); } @@ -88,7 +94,7 @@ class Conversations extends BaseModule throw new NotFoundException($this->t('Contact not found.')); } - $localRelationship = $this->localRelationship->getForUserContact(local_user(), $contact['id']); + $localRelationship = $this->localRelationship->getForUserContact($this->userSession->getLocalUserId(), $contact['id']); if ($localRelationship->rel === Model\Contact::SELF) { $this->baseUrl->redirect('profile/' . $contact['nick']); }