mirror of
https://github.com/friendica/friendica
synced 2025-04-25 07:50:10 +00:00
Replace calls of App::setProfileOwner with AppHelper
This commit is contained in:
parent
9477e1b55f
commit
6a6a5af3b2
5 changed files with 30 additions and 28 deletions
|
@ -8,6 +8,7 @@
|
|||
namespace Friendica\Module\Item;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\AppHelper;
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Content\Conversation;
|
||||
use Friendica\Content\Item as ContentItem;
|
||||
|
@ -46,8 +47,8 @@ class Display extends BaseModule
|
|||
protected $pConfig;
|
||||
/** @var IHandleUserSessions */
|
||||
protected $session;
|
||||
/** @var App */
|
||||
protected $app;
|
||||
/** @var AppHelper */
|
||||
protected $appHelper;
|
||||
/** @var ContentItem */
|
||||
protected $contentItem;
|
||||
/** @var Conversation */
|
||||
|
@ -57,7 +58,7 @@ class Display extends BaseModule
|
|||
/** @var Notify */
|
||||
protected $notify;
|
||||
|
||||
public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, IManageConfigValues $config, IManagePersonalConfigValues $pConfig, IHandleUserSessions $session, App $app, App\Page $page, ContentItem $contentItem, Conversation $conversation, Notification $notification, Notify $notify, array $server, array $parameters = [])
|
||||
public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, IManageConfigValues $config, IManagePersonalConfigValues $pConfig, IHandleUserSessions $session, AppHelper $appHelper, App\Page $page, ContentItem $contentItem, Conversation $conversation, Notification $notification, Notify $notify, array $server, array $parameters = [])
|
||||
{
|
||||
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
||||
|
||||
|
@ -65,7 +66,7 @@ class Display extends BaseModule
|
|||
$this->config = $config;
|
||||
$this->pConfig = $pConfig;
|
||||
$this->session = $session;
|
||||
$this->app = $app;
|
||||
$this->appHelper = $appHelper;
|
||||
$this->contentItem = $contentItem;
|
||||
$this->conversation = $conversation;
|
||||
$this->notification = $notification;
|
||||
|
@ -175,12 +176,12 @@ class Display extends BaseModule
|
|||
}
|
||||
|
||||
if ($this->baseUrl->isLocalUrl($author['url'])) {
|
||||
Profile::load($this->app, $author['nick'], false);
|
||||
Profile::load($this->appHelper, $author['nick'], false);
|
||||
} else {
|
||||
$this->page['aside'] = Widget\VCard::getHTML($author);
|
||||
}
|
||||
|
||||
$this->app->setProfileOwner($item['uid']);
|
||||
$this->appHelper->setProfileOwner($item['uid']);
|
||||
}
|
||||
|
||||
protected function getDisplayData(array $item, bool $update = false, int $updateUid = 0, bool $force = false): string
|
||||
|
|
|
@ -41,7 +41,7 @@ class Display extends DisplayModule
|
|||
throw new HTTPException\NotFoundException($this->t('The requested item doesn\'t exist or has been deleted.'));
|
||||
}
|
||||
|
||||
$this->app->setProfileOwner($item['uid'] ?: $profileUid);
|
||||
$this->appHelper->setProfileOwner($item['uid'] ?: $profileUid);
|
||||
$parentUriId = $item['parent-uri-id'];
|
||||
|
||||
if (empty($force)) {
|
||||
|
|
|
@ -23,21 +23,21 @@ class Profile extends BaseModule
|
|||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
$a = DI::app();
|
||||
$appHelper = DI::apphelper();
|
||||
|
||||
// Ensure we've got a profile owner if updating.
|
||||
$a->setProfileOwner((int)($request['p'] ?? 0));
|
||||
$appHelper->setProfileOwner((int)($request['p'] ?? 0));
|
||||
|
||||
if (DI::config()->get('system', 'block_public') && !DI::userSession()->getLocalUserId() && !DI::userSession()->getRemoteContactID($a->getProfileOwner())) {
|
||||
if (DI::config()->get('system', 'block_public') && !DI::userSession()->getLocalUserId() && !DI::userSession()->getRemoteContactID($appHelper->getProfileOwner())) {
|
||||
throw new ForbiddenException();
|
||||
}
|
||||
|
||||
$remote_contact = DI::userSession()->getRemoteContactID($a->getProfileOwner());
|
||||
$is_owner = DI::userSession()->getLocalUserId() == $a->getProfileOwner();
|
||||
$last_updated_key = "profile:" . $a->getProfileOwner() . ":" . DI::userSession()->getLocalUserId() . ":" . $remote_contact;
|
||||
$remote_contact = DI::userSession()->getRemoteContactID($appHelper->getProfileOwner());
|
||||
$is_owner = DI::userSession()->getLocalUserId() == $appHelper->getProfileOwner();
|
||||
$last_updated_key = "profile:" . $appHelper->getProfileOwner() . ":" . DI::userSession()->getLocalUserId() . ":" . $remote_contact;
|
||||
|
||||
if (!DI::userSession()->isAuthenticated()) {
|
||||
$user = User::getById($a->getProfileOwner(), ['hidewall']);
|
||||
$user = User::getById($appHelper->getProfileOwner(), ['hidewall']);
|
||||
if ($user['hidewall']) {
|
||||
throw new ForbiddenException(DI::l10n()->t('Access to this profile has been restricted.'));
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ class Profile extends BaseModule
|
|||
}
|
||||
|
||||
// Get permissions SQL - if $remote_contact is true, our remote user has been pre-verified and we already have fetched their circles
|
||||
$sql_extra = Item::getPermissionsSQLByUserId($a->getProfileOwner());
|
||||
$sql_extra = Item::getPermissionsSQLByUserId($appHelper->getProfileOwner());
|
||||
|
||||
$last_updated_array = DI::session()->get('last_updated', []);
|
||||
|
||||
|
@ -58,7 +58,7 @@ class Profile extends BaseModule
|
|||
|
||||
$condition = ["`uid` = ? AND NOT `contact-blocked` AND NOT `contact-pending`
|
||||
AND `visible` AND (NOT `deleted` OR `gravity` = ?)
|
||||
AND `wall` " . $sql_extra, $a->getProfileOwner(), Item::GRAVITY_ACTIVITY];
|
||||
AND `wall` " . $sql_extra, $appHelper->getProfileOwner(), Item::GRAVITY_ACTIVITY];
|
||||
|
||||
if ($request['force'] && !empty($request['item'])) {
|
||||
// When the parent is provided, we only fetch this
|
||||
|
@ -90,7 +90,7 @@ class Profile extends BaseModule
|
|||
$last_updated_array[$last_updated_key] = time();
|
||||
DI::session()->set('last_updated', $last_updated_array);
|
||||
|
||||
if ($is_owner && !$a->getProfileOwner() && ProfileModel::shouldDisplayEventList(DI::userSession()->getLocalUserId(), DI::mode())) {
|
||||
if ($is_owner && !$appHelper->getProfileOwner() && ProfileModel::shouldDisplayEventList(DI::userSession()->getLocalUserId(), DI::mode())) {
|
||||
$o .= ProfileModel::getBirthdays(DI::userSession()->getLocalUserId());
|
||||
$o .= ProfileModel::getEventsReminderHTML(DI::userSession()->getLocalUserId(), DI::userSession()->getPublicContactId());
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ class Profile extends BaseModule
|
|||
}
|
||||
}
|
||||
|
||||
$o .= DI::conversation()->render($items, Conversation::MODE_PROFILE, $a->getProfileOwner(), false, 'received', $a->getProfileOwner());
|
||||
$o .= DI::conversation()->render($items, Conversation::MODE_PROFILE, $appHelper->getProfileOwner(), false, 'received', $appHelper->getProfileOwner());
|
||||
|
||||
System::htmlUpdateExit($o);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue