From: Michael Date: Fri, 6 Oct 2023 08:20:17 +0000 (+0000) Subject: Channel class confusion solved X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=22e0bb58d9e51bd1386378aa4a51fbedd8579f8f;p=friendica.git Channel class confusion solved --- diff --git a/src/Content/Conversation/Repository/Channel.php b/src/Content/Conversation/Repository/Channel.php index 19defd59d3..19fac3b0d8 100644 --- a/src/Content/Conversation/Repository/Channel.php +++ b/src/Content/Conversation/Repository/Channel.php @@ -22,6 +22,7 @@ namespace Friendica\Content\Conversation\Repository; use Friendica\BaseCollection; +use Friendica\Content\Conversation\Entity\Timeline as TimelineEntity; use Friendica\Content\Conversation\Entity\UserDefinedChannel; use Friendica\Content\Conversation\Factory\Timeline; use Friendica\Database\Database; @@ -41,10 +42,10 @@ class Channel extends \Friendica\BaseRepository * * @param int $id The id of the user defined channel * @param int $uid The user that this channel belongs to. (Not part of the primary key) - * @return UserDefinedChannel + * @return TimelineEntity * @throws \Friendica\Network\HTTPException\NotFoundException */ - public function selectById(int $id, int $uid): UserDefinedChannel + public function selectById(int $id, int $uid): TimelineEntity { return $this->_selectOne(['id' => $id, 'uid' => $uid]); } diff --git a/src/Module/Conversation/Channel.php b/src/Module/Conversation/Channel.php index bb6a805d65..261a5a5d48 100644 --- a/src/Module/Conversation/Channel.php +++ b/src/Module/Conversation/Channel.php @@ -63,7 +63,7 @@ class Channel extends Timeline /** @var SystemMessages */ protected $systemMessages; /** @var ChannelFactory */ - protected $channel; + protected $channelFactory; /** @var UserDefinedChannelFactory */ protected $userDefinedChannel; /** @var CommunityFactory */ @@ -79,7 +79,7 @@ class Channel extends Timeline $this->conversation = $conversation; $this->page = $page; $this->systemMessages = $systemMessages; - $this->channel = $channelFactory; + $this->channelFactory = $channelFactory; $this->community = $community; $this->networkFactory = $network; $this->userDefinedChannel = $userDefinedChannel; @@ -105,7 +105,7 @@ class Channel extends Timeline } if (empty($request['mode']) || ($request['mode'] != 'raw')) { - $tabs = $this->getTabArray($this->channel->getTimelines($this->session->getLocalUserId()), 'channel'); + $tabs = $this->getTabArray($this->channelFactory->getTimelines($this->session->getLocalUserId()), 'channel'); $tabs = array_merge($tabs, $this->getTabArray($this->userDefinedChannel->getForUser($this->session->getLocalUserId()), 'channel')); $tabs = array_merge($tabs, $this->getTabArray($this->community->getTimelines(true), 'channel')); @@ -128,7 +128,7 @@ class Channel extends Timeline $o .= $this->conversation->statusEditor([], 0, true); } - if ($this->channel->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) { + if ($this->channelFactory->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) { $items = $this->getChannelItems(); $order = 'created'; } else { @@ -174,7 +174,7 @@ class Channel extends Timeline $this->selectedTab = ChannelEntity::FORYOU; } - if (!$this->channel->isTimeline($this->selectedTab) && !$this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId()) && !$this->community->isTimeline($this->selectedTab)) { + if (!$this->channelFactory->isTimeline($this->selectedTab) && !$this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId()) && !$this->community->isTimeline($this->selectedTab)) { throw new HTTPException\BadRequestException($this->l10n->t('Channel not available.')); } diff --git a/src/Module/Conversation/Network.php b/src/Module/Conversation/Network.php index 40f7d1239e..f754b41260 100644 --- a/src/Module/Conversation/Network.php +++ b/src/Module/Conversation/Network.php @@ -101,7 +101,7 @@ class Network extends Timeline /** @var TimelineFactory */ protected $timeline; /** @var ChannelFactory */ - protected $channel; + protected $channelFactory; /** @var UserDefinedChannelFactory */ protected $userDefinedChannel; /** @var CommunityFactory */ @@ -118,7 +118,7 @@ class Network extends Timeline $this->systemMessages = $systemMessages; $this->conversation = $conversation; $this->page = $page; - $this->channel = $channelFactory; + $this->channelFactory = $channelFactory; $this->community = $community; $this->networkFactory = $network; $this->userDefinedChannel = $userDefinedChannel; @@ -139,7 +139,7 @@ class Network extends Timeline $o = ''; - if ($this->channel->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) { + if ($this->channelFactory->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) { $items = $this->getChannelItems(); } elseif ($this->community->isTimeline($this->selectedTab)) { $items = $this->getCommunityItems(); @@ -286,7 +286,7 @@ class Network extends Timeline $network_timelines = $this->pConfig->get($this->session->getLocalUserId(), 'system', 'network_timelines', []); if (!empty($network_timelines)) { - $tabs = array_merge($tabs, $this->getTabArray($this->channel->getTimelines($this->session->getLocalUserId()), 'network', 'channel')); + $tabs = array_merge($tabs, $this->getTabArray($this->channelFactory->getTimelines($this->session->getLocalUserId()), 'network', 'channel')); $tabs = array_merge($tabs, $this->getTabArray($this->userDefinedChannel->getForUser($this->session->getLocalUserId()), 'network', 'channel')); $tabs = array_merge($tabs, $this->getTabArray($this->community->getTimelines(true), 'network', 'channel')); } @@ -321,11 +321,11 @@ class Network extends Timeline if (!$this->selectedTab) { $this->selectedTab = self::getTimelineOrderBySession($this->session, $this->pConfig); - } elseif (!$this->networkFactory->isTimeline($this->selectedTab) && !$this->channel->isTimeline($this->selectedTab) && !$this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId()) && !$this->community->isTimeline($this->selectedTab)) { + } elseif (!$this->networkFactory->isTimeline($this->selectedTab) && !$this->channelFactory->isTimeline($this->selectedTab) && !$this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId()) && !$this->community->isTimeline($this->selectedTab)) { throw new HTTPException\BadRequestException($this->l10n->t('Network feed not available.')); } - if (($this->network || $this->circleId || $this->groupContactId) && ($this->channel->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId()) || $this->community->isTimeline($this->selectedTab))) { + if (($this->network || $this->circleId || $this->groupContactId) && ($this->channelFactory->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId()) || $this->community->isTimeline($this->selectedTab))) { $this->selectedTab = NetworkEntity::RECEIVED; } @@ -350,7 +350,7 @@ class Network extends Timeline $this->mention = false; } elseif (in_array($this->selectedTab, [NetworkEntity::RECEIVED, NetworkEntity::STAR]) || $this->community->isTimeline($this->selectedTab)) { $this->order = 'received'; - } elseif (($this->selectedTab == NetworkEntity::CREATED) || $this->channel->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) { + } elseif (($this->selectedTab == NetworkEntity::CREATED) || $this->channelFactory->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) { $this->order = 'created'; } else { $this->order = 'commented'; diff --git a/src/Module/Conversation/Timeline.php b/src/Module/Conversation/Timeline.php index 7d3a7b2971..3f7f3ef759 100644 --- a/src/Module/Conversation/Timeline.php +++ b/src/Module/Conversation/Timeline.php @@ -26,7 +26,6 @@ use Friendica\App\Mode; use Friendica\BaseModule; use Friendica\Content\Conversation\Collection\Timelines; use Friendica\Content\Conversation\Entity\Channel as ChannelEntity; -use Friendica\Content\Conversation\Entity\UserDefinedChannel as UserDefinedChannelEntity; use Friendica\Content\Conversation\Repository\Channel; use Friendica\Core\Cache\Capability\ICanCache; use Friendica\Core\Cache\Enum\Duration; diff --git a/src/Module/Update/Channel.php b/src/Module/Update/Channel.php index 8435a7cc1b..9382512da5 100644 --- a/src/Module/Update/Channel.php +++ b/src/Module/Update/Channel.php @@ -38,7 +38,7 @@ class Channel extends ChannelModule $o = ''; if ($this->update || $this->force) { - if ($this->channel->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) { + if ($this->channelFactory->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) { $items = $this->getChannelItems(); } else { $items = $this->getCommunityItems(); diff --git a/src/Module/Update/Network.php b/src/Module/Update/Network.php index 983680ac0b..64f5ea5733 100644 --- a/src/Module/Update/Network.php +++ b/src/Module/Update/Network.php @@ -41,7 +41,7 @@ class Network extends NetworkModule System::htmlUpdateExit($o); } - if ($this->channel->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) { + if ($this->channelFactory->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) { $items = $this->getChannelItems(); } elseif ($this->community->isTimeline($this->selectedTab)) { $items = $this->getCommunityItems();