]> git.mxchange.org Git - friendica.git/commitdiff
Channel class confusion solved
authorMichael <heluecht@pirati.ca>
Fri, 6 Oct 2023 08:20:17 +0000 (08:20 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 6 Oct 2023 08:20:17 +0000 (08:20 +0000)
src/Content/Conversation/Repository/Channel.php
src/Module/Conversation/Channel.php
src/Module/Conversation/Network.php
src/Module/Conversation/Timeline.php
src/Module/Update/Channel.php
src/Module/Update/Network.php

index 19defd59d32f4510cc426e4b304a789654d2db9b..19fac3b0d83dba13c50e7bafb59ab0d6d9cc817b 100644 (file)
@@ -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]);
        }
index bb6a805d65ee6d9ae6e882de5084a99ba69e7d91..261a5a5d48420dbf0048f46a1a064cdede2633a1 100644 (file)
@@ -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.'));
                }
 
index 40f7d1239e51c41e57a293499cd60c40bab0b476..f754b41260a9c5858da3200c82bcafa5d73d4037 100644 (file)
@@ -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';
index 7d3a7b29715757ea9c94475ed971d5a0f785a161..3f7f3ef759498176dc8cbf7b446b3263d7939eb2 100644 (file)
@@ -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;
index 8435a7cc1bb5c6a00291567765a3ffe64bcc9e29..9382512da522d37ec58ec9a44703ee8205bfa697 100644 (file)
@@ -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();
index 983680ac0b2981ec685707faf592f4803d2145f5..64f5ea5733028e980f42bc68e578716366f2911b 100644 (file)
@@ -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();