]> git.mxchange.org Git - friendica.git/commitdiff
Clean channel confusion
authorMichael <heluecht@pirati.ca>
Fri, 6 Oct 2023 11:38:29 +0000 (11:38 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 6 Oct 2023 11:38:29 +0000 (11:38 +0000)
src/Content/Conversation/Factory/Timeline.php
src/Content/Conversation/Factory/UserDefinedChannel.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 eb40100819ffd9b7346b947d69ad61d057c686b9..804f6a3382cde306c7fd694eee48ba5d23a95bc9 100644 (file)
@@ -35,15 +35,15 @@ class Timeline extends \Friendica\BaseFactory implements ICanCreateFromTableRow
        /** @var IManageConfigValues The config */
        protected $config;
        /** @var Channel */
-       protected $channel;
+       protected $channelRepository;
 
        public function __construct(Channel $channel, L10n $l10n, LoggerInterface $logger, IManageConfigValues $config)
        {
                parent::__construct($logger);
 
-               $this->channel = $channel;
-               $this->l10n    = $l10n;
-               $this->config  = $config;
+               $this->channelRepository = $channel;
+               $this->l10n              = $l10n;
+               $this->config            = $config;
        }
 
        public function createFromTableRow(array $row): TimelineEntity
index fe469a7b6f97caf51927208ad022eb7732ce3869..cb3e86c1d7ed7d1dbaac1f097e6584db09b82ac6 100644 (file)
@@ -42,7 +42,7 @@ final class UserDefinedChannel extends Timeline
         */
        public function getForUser(int $uid): Timelines
        {
-               foreach ($this->channel->selectByUid($uid) as $channel) {
+               foreach ($this->channelRepository->selectByUid($uid) as $channel) {
                        $tabs[] = $channel;
                }
 
@@ -51,6 +51,6 @@ final class UserDefinedChannel extends Timeline
 
        public function isTimeline(string $selectedTab, int $uid): bool
        {
-               return is_numeric($selectedTab) && $uid && $this->channel->existsById($selectedTab, $uid);
+               return is_numeric($selectedTab) && $uid && $this->channelRepository->existsById($selectedTab, $uid);
        }
 }
index 261a5a5d48420dbf0048f46a1a064cdede2633a1..dab17c4e199d9f10a376fde59d33faab1671bc87 100644 (file)
@@ -32,7 +32,6 @@ use Friendica\Content\Conversation\Repository\Channel as ChannelRepository;
 use Friendica\Content\Conversation\Factory\Channel as ChannelFactory;
 use Friendica\Content\Conversation\Factory\Community as CommunityFactory;
 use Friendica\Content\Conversation\Factory\Network as NetworkFactory;
-use Friendica\Content\Conversation\Factory\UserDefinedChannel;
 use Friendica\Content\Feature;
 use Friendica\Content\Nav;
 use Friendica\Content\Text\HTML;
@@ -63,7 +62,7 @@ class Channel extends Timeline
        /** @var SystemMessages */
        protected $systemMessages;
        /** @var ChannelFactory */
-       protected $channelFactory;
+       protected $channel;
        /** @var UserDefinedChannelFactory */
        protected $userDefinedChannel;
        /** @var CommunityFactory */
@@ -79,7 +78,7 @@ class Channel extends Timeline
                $this->conversation       = $conversation;
                $this->page               = $page;
                $this->systemMessages     = $systemMessages;
-               $this->channelFactory     = $channelFactory;
+               $this->channel            = $channelFactory;
                $this->community          = $community;
                $this->networkFactory     = $network;
                $this->userDefinedChannel = $userDefinedChannel;
@@ -105,7 +104,7 @@ class Channel extends Timeline
                }
 
                if (empty($request['mode']) || ($request['mode'] != 'raw')) {
-                       $tabs = $this->getTabArray($this->channelFactory->getTimelines($this->session->getLocalUserId()), 'channel');
+                       $tabs = $this->getTabArray($this->channel->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 +127,7 @@ class Channel extends Timeline
                        $o .= $this->conversation->statusEditor([], 0, true);
                }
 
-               if ($this->channelFactory->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
+               if ($this->channel->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
                        $items = $this->getChannelItems();
                        $order = 'created';
                } else {
@@ -174,7 +173,7 @@ class Channel extends Timeline
                        $this->selectedTab = ChannelEntity::FORYOU;
                }
 
-               if (!$this->channelFactory->isTimeline($this->selectedTab) && !$this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId()) && !$this->community->isTimeline($this->selectedTab)) {
+               if (!$this->channel->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 f754b41260a9c5858da3200c82bcafa5d73d4037..40f7d1239e51c41e57a293499cd60c40bab0b476 100644 (file)
@@ -101,7 +101,7 @@ class Network extends Timeline
        /** @var TimelineFactory */
        protected $timeline;
        /** @var ChannelFactory */
-       protected $channelFactory;
+       protected $channel;
        /** @var UserDefinedChannelFactory */
        protected $userDefinedChannel;
        /** @var CommunityFactory */
@@ -118,7 +118,7 @@ class Network extends Timeline
                $this->systemMessages     = $systemMessages;
                $this->conversation       = $conversation;
                $this->page               = $page;
-               $this->channelFactory     = $channelFactory;
+               $this->channel            = $channelFactory;
                $this->community          = $community;
                $this->networkFactory     = $network;
                $this->userDefinedChannel = $userDefinedChannel;
@@ -139,7 +139,7 @@ class Network extends Timeline
 
                $o = '';
 
-               if ($this->channelFactory->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
+               if ($this->channel->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->channelFactory->getTimelines($this->session->getLocalUserId()), 'network', 'channel'));
+                       $tabs = array_merge($tabs, $this->getTabArray($this->channel->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->channelFactory->isTimeline($this->selectedTab) && !$this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId()) && !$this->community->isTimeline($this->selectedTab)) {
+               } elseif (!$this->networkFactory->isTimeline($this->selectedTab) && !$this->channel->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->channelFactory->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId()) || $this->community->isTimeline($this->selectedTab))) {
+               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))) {
                        $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->channelFactory->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
+               } elseif (($this->selectedTab == NetworkEntity::CREATED) || $this->channel->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
                        $this->order = 'created';
                } else {
                        $this->order = 'commented';
index 3f7f3ef759498176dc8cbf7b446b3263d7939eb2..8ddba16c71961ae88fc069613b4ec9c561aaad3b 100644 (file)
@@ -81,19 +81,19 @@ class Timeline extends BaseModule
        /** @var ICanCache */
        protected $cache;
        /** @var Channel */
-       protected $channel;
+       protected $channelRepository;
 
        public function __construct(Channel $channel, Mode $mode, IHandleUserSessions $session, Database $database, IManagePersonalConfigValues $pConfig, IManageConfigValues $config, ICanCache $cache, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
        {
                parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
 
-               $this->channel  = $channel;
-               $this->mode     = $mode;
-               $this->session  = $session;
-               $this->database = $database;
-               $this->pConfig  = $pConfig;
-               $this->config   = $config;
-               $this->cache    = $cache;
+               $this->channelRepository = $channel;
+               $this->mode              = $mode;
+               $this->session           = $session;
+               $this->database          = $database;
+               $this->pConfig           = $pConfig;
+               $this->config            = $config;
+               $this->cache             = $cache;
        }
 
        /**
@@ -368,7 +368,7 @@ class Timeline extends BaseModule
 
        private function getUserChannelConditions(int $id, int $uid): array
        {
-               $channel = $this->channel->selectById($id, $uid);
+               $channel = $this->channelRepository->selectById($id, $uid);
                if (empty($channel)) {
                        return [];
                }
index 9382512da522d37ec58ec9a44703ee8205bfa697..8435a7cc1bb5c6a00291567765a3ffe64bcc9e29 100644 (file)
@@ -38,7 +38,7 @@ class Channel extends ChannelModule
 
                $o = '';
                if ($this->update || $this->force) {
-                       if ($this->channelFactory->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
+                       if ($this->channel->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
                                $items = $this->getChannelItems();
                        } else {
                                $items = $this->getCommunityItems();
index 64f5ea5733028e980f42bc68e578716366f2911b..983680ac0b2981ec685707faf592f4803d2145f5 100644 (file)
@@ -41,7 +41,7 @@ class Network extends NetworkModule
                        System::htmlUpdateExit($o);
                }
 
-               if ($this->channelFactory->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
+               if ($this->channel->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
                        $items = $this->getChannelItems();
                } elseif ($this->community->isTimeline($this->selectedTab)) {
                        $items = $this->getCommunityItems();