Some more class changes

This commit is contained in:
Michael 2023-09-03 03:35:10 +00:00
parent 53bd34ed8d
commit 3c84a22b32
2 changed files with 18 additions and 19 deletions

View file

@ -67,23 +67,23 @@ class Channel extends BaseModule
protected static $item_id; protected static $item_id;
/** @var UserSession */ /** @var UserSession */
private $session; protected $session;
/** @var ICanCache */ /** @var ICanCache */
private $cache; protected $cache;
/** @var IManageConfigValues The config */ /** @var IManageConfigValues The config */
private $config; protected $config;
/** @var SystemMessages */ /** @var SystemMessages */
private $systemMessages; protected $systemMessages;
/** @var App\Page */ /** @var App\Page */
private $page; protected $page;
/** @var Conversation */ /** @var Conversation */
private $conversation; protected $conversation;
/** @var App\Mode $mode */ /** @var App\Mode $mode */
private $mode; protected $mode;
/** @var IManagePersonalConfigValues */ /** @var IManagePersonalConfigValues */
private $pConfig; protected $pConfig;
/** @var Database */ /** @var Database */
private $database; protected $database;
public function __construct(Database $database, IManagePersonalConfigValues $pConfig, Mode $mode, Conversation $conversation, App\Page $page, IManageConfigValues $config, ICanCache $cache, IHandleUserSessions $session, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = []) public function __construct(Database $database, IManagePersonalConfigValues $pConfig, Mode $mode, Conversation $conversation, App\Page $page, IManageConfigValues $config, ICanCache $cache, IHandleUserSessions $session, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
@ -221,7 +221,7 @@ class Channel extends BaseModule
$o .= $this->conversation->statusEditor([], 0, true); $o .= $this->conversation->statusEditor([], 0, true);
} }
$items = $this->getItems($request, $this->session, $this->cache); $items = $this->getItems($request);
if (!$this->database->isResult($items)) { if (!$this->database->isResult($items)) {
$this->systemMessages->addNotice($this->l10n->t('No results.')); $this->systemMessages->addNotice($this->l10n->t('No results.'));
@ -304,7 +304,7 @@ class Channel extends BaseModule
* @return array * @return array
* @throws \Exception * @throws \Exception
*/ */
protected function getItems(array $request, UserSession $session, ICanCache $cache) protected function getItems(array $request)
{ {
if (self::$content == self::WHATSHOT) { if (self::$content == self::WHATSHOT) {
if (!is_null(self::$accountType)) { if (!is_null(self::$accountType)) {
@ -313,15 +313,15 @@ class Channel extends BaseModule
$condition = ["(`comments` >= ? OR `activities` >= ?) AND `contact-type` != ?", $this->getMedianComments(4), $this->getMedianActivities(4), Contact::TYPE_COMMUNITY]; $condition = ["(`comments` >= ? OR `activities` >= ?) AND `contact-type` != ?", $this->getMedianComments(4), $this->getMedianActivities(4), Contact::TYPE_COMMUNITY];
} }
} elseif (self::$content == self::FORYOU) { } elseif (self::$content == self::FORYOU) {
$cid = Contact::getPublicIdByUserId($session->getLocalUserId()); $cid = Contact::getPublicIdByUserId($this->session->getLocalUserId());
$condition = ["(`owner-id` IN (SELECT `relation-cid` FROM `contact-relation` WHERE `cid` = ? AND `thread-score` > ?) OR $condition = ["(`owner-id` IN (SELECT `relation-cid` FROM `contact-relation` WHERE `cid` = ? AND `thread-score` > ?) OR
((`comments` >= ? OR `activities` >= ?) AND `owner-id` IN (SELECT `pid` FROM `account-user-view` WHERE `uid` = ? AND `rel` IN (?, ?))) OR ((`comments` >= ? OR `activities` >= ?) AND `owner-id` IN (SELECT `pid` FROM `account-user-view` WHERE `uid` = ? AND `rel` IN (?, ?))) OR
( `owner-id` IN (SELECT `pid` FROM `account-user-view` WHERE `uid` = ? AND `rel` IN (?, ?) AND `notify_new_posts`)))", ( `owner-id` IN (SELECT `pid` FROM `account-user-view` WHERE `uid` = ? AND `rel` IN (?, ?) AND `notify_new_posts`)))",
$cid, $this->getMedianThreadScore($cid, 4), $this->getMedianComments(4), $this->getMedianActivities(4), $session->getLocalUserId(), Contact::FRIEND, Contact::SHARING, $cid, $this->getMedianThreadScore($cid, 4), $this->getMedianComments(4), $this->getMedianActivities(4), $this->session->getLocalUserId(), Contact::FRIEND, Contact::SHARING,
$session->getLocalUserId(), Contact::FRIEND, Contact::SHARING]; $this->session->getLocalUserId(), Contact::FRIEND, Contact::SHARING];
} elseif (self::$content == self::FOLLOWERS) { } elseif (self::$content == self::FOLLOWERS) {
$condition = ["`owner-id` IN (SELECT `pid` FROM `account-user-view` WHERE `uid` = ? AND `rel` = ?)", $session->getLocalUserId(), Contact::FOLLOWER]; $condition = ["`owner-id` IN (SELECT `pid` FROM `account-user-view` WHERE `uid` = ? AND `rel` = ?)", $this->session->getLocalUserId(), Contact::FOLLOWER];
} elseif (self::$content == self::IMAGE) { } elseif (self::$content == self::IMAGE) {
$condition = ["`media-type` & ?", 1]; $condition = ["`media-type` & ?", 1];
} elseif (self::$content == self::VIDEO) { } elseif (self::$content == self::VIDEO) {
@ -331,7 +331,7 @@ class Channel extends BaseModule
} }
$condition[0] .= " AND NOT EXISTS(SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND `cid` = `post-engagement`.`owner-id` AND (`ignored` OR `blocked` OR `collapsed`))"; $condition[0] .= " AND NOT EXISTS(SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND `cid` = `post-engagement`.`owner-id` AND (`ignored` OR `blocked` OR `collapsed`))";
$condition[] = $session->getLocalUserId(); $condition[] = $this->session->getLocalUserId();
if ((self::$content != self::WHATSHOT) && !is_null(self::$accountType)) { if ((self::$content != self::WHATSHOT) && !is_null(self::$accountType)) {
$condition[0] .= " AND `contact-type` = ?"; $condition[0] .= " AND `contact-type` = ?";
@ -346,7 +346,7 @@ class Channel extends BaseModule
} else { } else {
if (!empty($request['no_sharer'])) { if (!empty($request['no_sharer'])) {
$condition[0] .= " AND NOT `uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `post-user`.`uid` = ? AND `post-user`.`uri-id` = `post-engagement`.`uri-id`)"; $condition[0] .= " AND NOT `uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `post-user`.`uid` = ? AND `post-user`.`uri-id` = `post-engagement`.`uri-id`)";
$condition[] = $session->getLocalUserId(); $condition[] = $this->session->getLocalUserId();
} }
if (isset(self::$max_id)) { if (isset(self::$max_id)) {

View file

@ -23,7 +23,6 @@ namespace Friendica\Module\Update;
use Friendica\Content\Conversation; use Friendica\Content\Conversation;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\DI;
use Friendica\Module\Conversation\Channel as ChannelModule; use Friendica\Module\Conversation\Channel as ChannelModule;
/** /**
@ -39,7 +38,7 @@ class Channel extends ChannelModule
$o = ''; $o = '';
if (!empty($request['force'])) { if (!empty($request['force'])) {
$o = DI::conversation()->render(self::getItems($request), Conversation::MODE_CHANNEL, true, false, 'created', DI::userSession()->getLocalUserId()); $o = $this->conversation->render($this->getItems($request), Conversation::MODE_CHANNEL, true, false, 'created', $this->session->getLocalUserId());
} }
System::htmlUpdateExit($o); System::htmlUpdateExit($o);