From: Michael Date: Thu, 5 Oct 2023 05:36:12 +0000 (+0000) Subject: Timeline classes are split into multiple classes X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6a86eeda10779d323af9312b5760807ff3e2e46f;p=friendica.git Timeline classes are split into multiple classes --- diff --git a/src/Content/Conversation/Entity/Channel.php b/src/Content/Conversation/Entity/Channel.php new file mode 100644 index 0000000000..669309cce1 --- /dev/null +++ b/src/Content/Conversation/Entity/Channel.php @@ -0,0 +1,39 @@ +. + * + */ + +namespace Friendica\Content\Conversation\Entity; + +class Channel extends Timeline +{ + const WHATSHOT = 'whatshot'; + const FORYOU = 'foryou'; + const FOLLOWERS = 'followers'; + const SHARERSOFSHARERS = 'sharersofsharers'; + const IMAGE = 'image'; + const VIDEO = 'video'; + const AUDIO = 'audio'; + const LANGUAGE = 'language'; + + public function __construct(string $code = null, string $label = null, string $description = null, string $accessKey = null, string $path = null, int $uid = null, string $includeTags = null, string $excludeTags = null, string $fullTextSearch = null, int $mediaType = null, int $circle = null) + { + parent::__construct($code, $label, $description, $accessKey, $path, $uid, $includeTags, $excludeTags, $fullTextSearch, $mediaType, $circle); + } +} diff --git a/src/Content/Conversation/Entity/Community.php b/src/Content/Conversation/Entity/Community.php new file mode 100644 index 0000000000..f7faf280b7 --- /dev/null +++ b/src/Content/Conversation/Entity/Community.php @@ -0,0 +1,33 @@ +. + * + */ + +namespace Friendica\Content\Conversation\Entity; + +final class Community extends Timeline +{ + const LOCAL = 'local'; + const GLOBAL = 'global'; + + public function __construct(string $code = null, string $label = null, string $description = null, string $accessKey = null, string $path = null, int $uid = null, string $includeTags = null, string $excludeTags = null, string $fullTextSearch = null, int $mediaType = null, int $circle = null) + { + parent::__construct($code, $label, $description, $accessKey, $path, $uid, $includeTags, $excludeTags, $fullTextSearch, $mediaType, $circle); + } +} diff --git a/src/Content/Conversation/Entity/Network.php b/src/Content/Conversation/Entity/Network.php new file mode 100644 index 0000000000..a212b97b89 --- /dev/null +++ b/src/Content/Conversation/Entity/Network.php @@ -0,0 +1,36 @@ +. + * + */ + +namespace Friendica\Content\Conversation\Entity; + +final class Network extends Timeline +{ + const STAR = 'star'; + const MENTION = 'mention'; + const RECEIVED = 'received'; + const COMMENTED = 'commented'; + const CREATED = 'created'; + + public function __construct(string $code = null, string $label = null, string $description = null, string $accessKey = null, string $path = null, int $uid = null, string $includeTags = null, string $excludeTags = null, string $fullTextSearch = null, int $mediaType = null, int $circle = null) + { + parent::__construct($code, $label, $description, $accessKey, $path, $uid, $includeTags, $excludeTags, $fullTextSearch, $mediaType, $circle); + } +} diff --git a/src/Content/Conversation/Entity/Timeline.php b/src/Content/Conversation/Entity/Timeline.php index 40a39cbb10..20223d5182 100644 --- a/src/Content/Conversation/Entity/Timeline.php +++ b/src/Content/Conversation/Entity/Timeline.php @@ -31,25 +31,11 @@ namespace Friendica\Content\Conversation\Entity; * @property-read string $includeTags The tags to include in the channel * @property-read string $excludeTags The tags to exclude in the channel * @property-read string $fullTextSearch full text search pattern + * @property-read int $mediaType Media types that are included in the channel + * @property-read int $circle Circle or timeline this channel is based on */ -final class Timeline extends \Friendica\BaseEntity +class Timeline extends \Friendica\BaseEntity { - const WHATSHOT = 'whatshot'; - const FORYOU = 'foryou'; - const FOLLOWERS = 'followers'; - const SHARERSOFSHARERS = 'sharersofsharers'; - const IMAGE = 'image'; - const VIDEO = 'video'; - const AUDIO = 'audio'; - const LANGUAGE = 'language'; - const LOCAL = 'local'; - const GLOBAL = 'global'; - const STAR = 'star'; - const MENTION = 'mention'; - const RECEIVED = 'received'; - const COMMENTED = 'commented'; - const CREATED = 'created'; - /** @var string */ protected $code; /** @var string */ diff --git a/src/Content/Conversation/Entity/UserDefinedChannel.php b/src/Content/Conversation/Entity/UserDefinedChannel.php new file mode 100644 index 0000000000..99124086c4 --- /dev/null +++ b/src/Content/Conversation/Entity/UserDefinedChannel.php @@ -0,0 +1,30 @@ +. + * + */ + +namespace Friendica\Content\Conversation\Entity; + +class UserDefinedChannel extends Channel +{ + public function __construct(string $code = null, string $label = null, string $description = null, string $accessKey = null, string $path = null, int $uid = null, string $includeTags = null, string $excludeTags = null, string $fullTextSearch = null, int $mediaType = null, int $circle = null) + { + parent::__construct($code, $label, $description, $accessKey, $path, $uid, $includeTags, $excludeTags, $fullTextSearch, $mediaType, $circle); + } +} diff --git a/src/Content/Conversation/Factory/Channel.php b/src/Content/Conversation/Factory/Channel.php new file mode 100644 index 0000000000..e151c99287 --- /dev/null +++ b/src/Content/Conversation/Factory/Channel.php @@ -0,0 +1,93 @@ +. + * + */ + +namespace Friendica\Content\Conversation\Factory; + +use Friendica\Content\Conversation\Collection\Timelines; +use Friendica\Content\Conversation\Entity\Channel as ChannelEntity; +use Friendica\Model\User; +use Friendica\Content\Conversation\Entity\Timeline as TimelineEntity; +use Friendica\Content\Conversation\Repository\Channel as ChannelRepository; +use Friendica\Core\Config\Capability\IManageConfigValues; +use Friendica\Core\L10n; +use Psr\Log\LoggerInterface; + +class Channel extends Timeline +{ + public function __construct(ChannelRepository $channel, L10n $l10n, LoggerInterface $logger, IManageConfigValues $config) + { + parent::__construct($channel, $l10n, $logger, $config); + } + + public function createFromTableRow(array $row): TimelineEntity + { + return new TimelineEntity( + $row['id'] ?? null, + $row['label'], + $row['description'] ?? null, + $row['access-key'] ?? null, + null, + $row['uid'], + $row['include-tags'] ?? null, + $row['exclude-tags'] ?? null, + $row['full-text-search'] ?? null, + $row['media-type'] ?? null, + $row['circle'] ?? null, + ); + } + + /** + * List of available channels + * + * @param integer $uid + * @return Timelines + */ + public function getForUser(int $uid): Timelines + { + $language = User::getLanguageCode($uid); + $languages = $this->l10n->getAvailableLanguages(true); + + $tabs = [ + new ChannelEntity(ChannelEntity::FORYOU, $this->l10n->t('For you'), $this->l10n->t('Posts from contacts you interact with and who interact with you'), 'y'), + new ChannelEntity(ChannelEntity::WHATSHOT, $this->l10n->t('What\'s Hot'), $this->l10n->t('Posts with a lot of interactions'), 'h'), + new ChannelEntity(ChannelEntity::LANGUAGE, $languages[$language], $this->l10n->t('Posts in %s', $languages[$language]), 'g'), + new ChannelEntity(ChannelEntity::FOLLOWERS, $this->l10n->t('Followers'), $this->l10n->t('Posts from your followers that you don\'t follow'), 'f'), + new ChannelEntity(ChannelEntity::SHARERSOFSHARERS, $this->l10n->t('Sharers of sharers'), $this->l10n->t('Posts from accounts that are followed by accounts that you follow'), 'r'), + new ChannelEntity(ChannelEntity::IMAGE, $this->l10n->t('Images'), $this->l10n->t('Posts with images'), 'i'), + new ChannelEntity(ChannelEntity::AUDIO, $this->l10n->t('Audio'), $this->l10n->t('Posts with audio'), 'd'), + new ChannelEntity(ChannelEntity::VIDEO, $this->l10n->t('Videos'), $this->l10n->t('Posts with videos'), 'v'), + ]; + + foreach ($this->channel->selectByUid($uid) as $channel) { + $tabs[] = $channel; + } + + return new Timelines($tabs); + } + + public function isTimeline(string $selectedTab, int $uid): bool + { + if (is_numeric($selectedTab) && $uid && $this->channel->existsById($selectedTab, $uid)) { + return true; + } + return in_array($selectedTab, [ChannelEntity::WHATSHOT, ChannelEntity::FORYOU, ChannelEntity::FOLLOWERS, ChannelEntity::SHARERSOFSHARERS, ChannelEntity::IMAGE, ChannelEntity::VIDEO, ChannelEntity::AUDIO, ChannelEntity::LANGUAGE]); + } +} diff --git a/src/Content/Conversation/Factory/Community.php b/src/Content/Conversation/Factory/Community.php new file mode 100644 index 0000000000..a21eb8d4eb --- /dev/null +++ b/src/Content/Conversation/Factory/Community.php @@ -0,0 +1,86 @@ +. + * + */ + +namespace Friendica\Content\Conversation\Factory; + +use Friendica\Content\Conversation\Collection\Timelines; +use Friendica\Content\Conversation\Entity\Channel as ChannelEntity; +use Friendica\Content\Conversation\Entity\Community as CommunityEntity; +use Friendica\Content\Conversation\Entity\Network; +use Friendica\Model\User; +use Friendica\Content\Conversation\Entity\Timeline as TimelineEntity; +use Friendica\Content\Conversation\Repository\Channel; +use Friendica\Core\Config\Capability\IManageConfigValues; +use Friendica\Core\L10n; +use Friendica\Module\Conversation\Community as CommunityModule; +use Psr\Log\LoggerInterface; + +class Community extends Timeline +{ + public function __construct(Channel $channel, L10n $l10n, LoggerInterface $logger, IManageConfigValues $config) + { + parent::__construct($channel, $l10n, $logger, $config); + } + + public function createFromTableRow(array $row): TimelineEntity + { + return new TimelineEntity( + $row['id'] ?? null, + $row['label'], + $row['description'] ?? null, + $row['access-key'] ?? null, + null, + $row['uid'], + $row['include-tags'] ?? null, + $row['exclude-tags'] ?? null, + $row['full-text-search'] ?? null, + $row['media-type'] ?? null, + $row['circle'] ?? null, + ); + } + + /** + * List of available communities + * + * @param boolean $authenticated + * @return Timelines + */ + public function getTimelines(bool $authenticated): Timelines + { + $page_style = $this->config->get('system', 'community_page_style'); + + $tabs = []; + + if (($authenticated || in_array($page_style, [CommunityModule::LOCAL_AND_GLOBAL, CommunityModule::LOCAL])) && empty($this->config->get('system', 'singleuser'))) { + $tabs[] = new CommunityEntity(CommunityEntity::LOCAL, $this->l10n->t('Local Community'), $this->l10n->t('Posts from local users on this server'), 'l'); + } + + if ($authenticated || in_array($page_style, [CommunityModule::LOCAL_AND_GLOBAL, CommunityModule::GLOBAL])) { + $tabs[] = new CommunityEntity(CommunityEntity::GLOBAL, $this->l10n->t('Global Community'), $this->l10n->t('Posts from users of the whole federated network'), 'g'); + } + return new Timelines($tabs); + } + + public function isTimeline(string $selectedTab): bool + { + return in_array($selectedTab, [CommunityEntity::LOCAL, CommunityEntity::GLOBAL]); + } +} diff --git a/src/Content/Conversation/Factory/Network.php b/src/Content/Conversation/Factory/Network.php new file mode 100644 index 0000000000..873cb150c5 --- /dev/null +++ b/src/Content/Conversation/Factory/Network.php @@ -0,0 +1,77 @@ +. + * + */ + +namespace Friendica\Content\Conversation\Factory; + +use Friendica\Content\Conversation\Collection\Timelines; +use Friendica\Content\Conversation\Entity\Network as NetworkEntity; +use Friendica\Content\Conversation\Repository\Channel; +use Friendica\Core\Config\Capability\IManageConfigValues; +use Friendica\Core\L10n; +use Psr\Log\LoggerInterface; + +final class Network extends Timeline +{ + public function __construct(Channel $channel, L10n $l10n, LoggerInterface $logger, IManageConfigValues $config) + { + parent::__construct($channel, $l10n, $logger, $config); + } + + public function createFromTableRow(array $row): NetworkEntity + { + return new NetworkEntity( + $row['id'] ?? null, + $row['label'], + $row['description'] ?? null, + $row['access-key'] ?? null, + null, + $row['uid'], + $row['include-tags'] ?? null, + $row['exclude-tags'] ?? null, + $row['full-text-search'] ?? null, + $row['media-type'] ?? null, + $row['circle'] ?? null, + ); + } + + /** + * List of available network timelines + * + * @param string $command + * @return Timelines + */ + public function getTimelines(string $command): Timelines + { + $tabs = [ + new NetworkEntity(NetworkEntity::COMMENTED, $this->l10n->t('Latest Activity'), $this->l10n->t('Sort by latest activity'), 'e', $command . '?' . http_build_query(['order' => 'commented'])), + new NetworkEntity(NetworkEntity::RECEIVED, $this->l10n->t('Latest Posts'), $this->l10n->t('Sort by post received date'), 't', $command . '?' . http_build_query(['order' => 'received'])), + new NetworkEntity(NetworkEntity::CREATED, $this->l10n->t('Latest Creation'), $this->l10n->t('Sort by post creation date'), 'q', $command . '?' . http_build_query(['order' => 'created'])), + new NetworkEntity(NetworkEntity::MENTION, $this->l10n->t('Personal'), $this->l10n->t('Posts that mention or involve you'), 'r', $command . '?' . http_build_query(['mention' => true])), + new NetworkEntity(NetworkEntity::STAR, $this->l10n->t('Starred'), $this->l10n->t('Favourite Posts'), 'm', $command . '?' . http_build_query(['star' => true])), + ]; + return new Timelines($tabs); + } + + public function isTimeline(string $selectedTab): bool + { + return in_array($selectedTab, [NetworkEntity::COMMENTED, NetworkEntity::RECEIVED, NetworkEntity::CREATED, NetworkEntity::MENTION, NetworkEntity::STAR]); + } +} diff --git a/src/Content/Conversation/Factory/Timeline.php b/src/Content/Conversation/Factory/Timeline.php index 459f061b12..eb40100819 100644 --- a/src/Content/Conversation/Factory/Timeline.php +++ b/src/Content/Conversation/Factory/Timeline.php @@ -22,16 +22,13 @@ namespace Friendica\Content\Conversation\Factory; use Friendica\Capabilities\ICanCreateFromTableRow; -use Friendica\Content\Conversation\Collection\Timelines; -use Friendica\Model\User; use Friendica\Content\Conversation\Entity\Timeline as TimelineEntity; use Friendica\Content\Conversation\Repository\Channel; use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\L10n; -use Friendica\Module\Conversation\Community; use Psr\Log\LoggerInterface; -final class Timeline extends \Friendica\BaseFactory implements ICanCreateFromTableRow +class Timeline extends \Friendica\BaseFactory implements ICanCreateFromTableRow { /** @var L10n */ protected $l10n; @@ -65,91 +62,4 @@ final class Timeline extends \Friendica\BaseFactory implements ICanCreateFromTab $row['circle'] ?? null, ); } - - /** - * List of available channels - * - * @param integer $uid - * @return Timelines - */ - public function getChannelsForUser(int $uid): Timelines - { - $language = User::getLanguageCode($uid); - $languages = $this->l10n->getAvailableLanguages(true); - - $tabs = [ - new TimelineEntity(TimelineEntity::FORYOU, $this->l10n->t('For you'), $this->l10n->t('Posts from contacts you interact with and who interact with you'), 'y'), - new TimelineEntity(TimelineEntity::WHATSHOT, $this->l10n->t('What\'s Hot'), $this->l10n->t('Posts with a lot of interactions'), 'h'), - new TimelineEntity(TimelineEntity::LANGUAGE, $languages[$language], $this->l10n->t('Posts in %s', $languages[$language]), 'g'), - new TimelineEntity(TimelineEntity::FOLLOWERS, $this->l10n->t('Followers'), $this->l10n->t('Posts from your followers that you don\'t follow'), 'f'), - new TimelineEntity(TimelineEntity::SHARERSOFSHARERS, $this->l10n->t('Sharers of sharers'), $this->l10n->t('Posts from accounts that are followed by accounts that you follow'), 'r'), - new TimelineEntity(TimelineEntity::IMAGE, $this->l10n->t('Images'), $this->l10n->t('Posts with images'), 'i'), - new TimelineEntity(TimelineEntity::AUDIO, $this->l10n->t('Audio'), $this->l10n->t('Posts with audio'), 'd'), - new TimelineEntity(TimelineEntity::VIDEO, $this->l10n->t('Videos'), $this->l10n->t('Posts with videos'), 'v'), - ]; - - foreach ($this->channel->selectByUid($uid) as $channel) { - $tabs[] = $channel; - } - - return new Timelines($tabs); - } - - /** - * List of available communities - * - * @param boolean $authenticated - * @return Timelines - */ - public function getCommunities(bool $authenticated): Timelines - { - $page_style = $this->config->get('system', 'community_page_style'); - - $tabs = []; - - if (($authenticated || in_array($page_style, [Community::LOCAL_AND_GLOBAL, Community::LOCAL])) && empty($this->config->get('system', 'singleuser'))) { - $tabs[] = new TimelineEntity(TimelineEntity::LOCAL, $this->l10n->t('Local Community'), $this->l10n->t('Posts from local users on this server'), 'l'); - } - - if ($authenticated || in_array($page_style, [Community::LOCAL_AND_GLOBAL, Community::GLOBAL])) { - $tabs[] = new TimelineEntity(TimelineEntity::GLOBAL, $this->l10n->t('Global Community'), $this->l10n->t('Posts from users of the whole federated network'), 'g'); - } - return new Timelines($tabs); - } - - /** - * List of available network feeds - * - * @param string $command - * @return Timelines - */ - public function getNetworkFeeds(string $command): Timelines - { - $tabs = [ - new TimelineEntity(TimelineEntity::COMMENTED, $this->l10n->t('Latest Activity'), $this->l10n->t('Sort by latest activity'), 'e', $command . '?' . http_build_query(['order' => 'commented'])), - new TimelineEntity(TimelineEntity::RECEIVED, $this->l10n->t('Latest Posts'), $this->l10n->t('Sort by post received date'), 't', $command . '?' . http_build_query(['order' => 'received'])), - new TimelineEntity(TimelineEntity::CREATED, $this->l10n->t('Latest Creation'), $this->l10n->t('Sort by post creation date'), 'q', $command . '?' . http_build_query(['order' => 'created'])), - new TimelineEntity(TimelineEntity::MENTION, $this->l10n->t('Personal'), $this->l10n->t('Posts that mention or involve you'), 'r', $command . '?' . http_build_query(['mention' => true])), - new TimelineEntity(TimelineEntity::STAR, $this->l10n->t('Starred'), $this->l10n->t('Favourite Posts'), 'm', $command . '?' . http_build_query(['star' => true])), - ]; - return new Timelines($tabs); - } - - public function isNetwork(string $selectedTab): bool - { - return in_array($selectedTab, [TimelineEntity::COMMENTED, TimelineEntity::RECEIVED, TimelineEntity::CREATED, TimelineEntity::MENTION, TimelineEntity::STAR]); - } - - public function isCommunity(string $selectedTab): bool - { - return in_array($selectedTab, [TimelineEntity::LOCAL, TimelineEntity::GLOBAL]); - } - - public function isChannel(string $selectedTab, int $uid): bool - { - if (is_numeric($selectedTab) && $uid && $this->channel->existsById($selectedTab, $uid)) { - return true; - } - return in_array($selectedTab, [TimelineEntity::WHATSHOT, TimelineEntity::FORYOU, TimelineEntity::FOLLOWERS, TimelineEntity::SHARERSOFSHARERS, TimelineEntity::IMAGE, TimelineEntity::VIDEO, TimelineEntity::AUDIO, TimelineEntity::LANGUAGE]); - } } diff --git a/src/Content/Conversation/Repository/Channel.php b/src/Content/Conversation/Repository/Channel.php index 2c5bb31799..19defd59d3 100644 --- a/src/Content/Conversation/Repository/Channel.php +++ b/src/Content/Conversation/Repository/Channel.php @@ -22,7 +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; use Psr\Log\LoggerInterface; @@ -41,10 +41,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 TimelineEntity + * @return UserDefinedChannel * @throws \Friendica\Network\HTTPException\NotFoundException */ - public function selectById(int $id, int $uid): TimelineEntity + public function selectById(int $id, int $uid): UserDefinedChannel { return $this->_selectOne(['id' => $id, 'uid' => $uid]); } @@ -84,7 +84,7 @@ class Channel extends \Friendica\BaseRepository return $this->_select(['uid' => $uid]); } - public function save(TimelineEntity $Channel): TimelineEntity + public function save(UserDefinedChannel $Channel): UserDefinedChannel { $fields = [ 'label' => $Channel->label, diff --git a/src/Content/Widget.php b/src/Content/Widget.php index 7078c4fe06..d69467ebcd 100644 --- a/src/Content/Widget.php +++ b/src/Content/Widget.php @@ -562,19 +562,19 @@ class Widget $enabled = DI::pConfig()->get($uid, 'system', 'enabled_timelines', []); - foreach (DI::TimelineFactory()->getNetworkFeeds('') as $channel) { + foreach (DI::NetworkFactory()->getTimelines('') as $channel) { if (empty($enabled) || in_array($channel->code, $enabled)) { $channels[] = ['ref' => $channel->code, 'name' => $channel->label]; } } - foreach (DI::TimelineFactory()->getChannelsForUser($uid) as $channel) { + foreach (DI::ChannelFactory()->getForUser($uid) as $channel) { if (empty($enabled) || in_array($channel->code, $enabled)) { $channels[] = ['ref' => $channel->code, 'name' => $channel->label]; } } - foreach (DI::TimelineFactory()->getCommunities(true) as $community) { + foreach (DI::CommunityFactory()->getTimelines(true) as $community) { if (empty($enabled) || in_array($community->code, $enabled)) { $channels[] = ['ref' => $community->code, 'name' => $community->label]; } diff --git a/src/DI.php b/src/DI.php index 5ffce51752..22dec89dba 100644 --- a/src/DI.php +++ b/src/DI.php @@ -555,6 +555,30 @@ abstract class DI return self::$dice->create(Content\Conversation\Factory\Timeline::class); } + /** + * @return Content\Conversation\Factory\Community + */ + public static function CommunityFactory() + { + return self::$dice->create(Content\Conversation\Factory\Community::class); + } + + /** + * @return Content\Conversation\Factory\Channel + */ + public static function ChannelFactory() + { + return self::$dice->create(Content\Conversation\Factory\Channel::class); + } + + /** + * @return Content\Conversation\Factory\Network + */ + public static function NetworkFactory() + { + return self::$dice->create(Content\Conversation\Factory\Network::class); + } + /** * @return Contact\Introduction\Repository\Introduction */ diff --git a/src/Module/Conversation/Channel.php b/src/Module/Conversation/Channel.php index 3affa1a156..20b0187804 100644 --- a/src/Module/Conversation/Channel.php +++ b/src/Module/Conversation/Channel.php @@ -25,9 +25,12 @@ use Friendica\App; use Friendica\App\Mode; use Friendica\Content\BoundariesPager; use Friendica\Content\Conversation; -use Friendica\Content\Conversation\Entity\Timeline as TimelineEntity; +use Friendica\Content\Conversation\Entity\Channel as ChannelEntity; use Friendica\Content\Conversation\Factory\Timeline as TimelineFactory; 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\Feature; use Friendica\Content\Nav; use Friendica\Content\Text\HTML; @@ -57,8 +60,14 @@ class Channel extends Timeline protected $page; /** @var SystemMessages */ protected $systemMessages; - - public function __construct(ChannelRepository $channel, TimelineFactory $timeline, Conversation $conversation, App\Page $page, SystemMessages $systemMessages, 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 = []) + /** @var ChannelFactory */ + protected $channel; + /** @var CommunityFactory */ + protected $community; + /** @var NetworkFactory */ + protected $networkFactory; + + public function __construct(NetworkFactory $network, CommunityFactory $community, ChannelFactory $channelFactory, ChannelRepository $channel, TimelineFactory $timeline, Conversation $conversation, App\Page $page, SystemMessages $systemMessages, 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($channel, $mode, $session, $database, $pConfig, $config, $cache, $l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters); @@ -66,6 +75,9 @@ class Channel extends Timeline $this->conversation = $conversation; $this->page = $page; $this->systemMessages = $systemMessages; + //$this->channel = $channelFactory; + $this->community = $community; + $this->networkFactory = $network; } protected function content(array $request = []): string @@ -88,8 +100,8 @@ class Channel extends Timeline } if (empty($request['mode']) || ($request['mode'] != 'raw')) { - $tabs = $this->getTabArray($this->timeline->getChannelsForUser($this->session->getLocalUserId()), 'channel'); - $tabs = array_merge($tabs, $this->getTabArray($this->timeline->getCommunities(true), 'channel')); + $tabs = $this->getTabArray($this->channel->getForUser($this->session->getLocalUserId()), 'channel'); + $tabs = array_merge($tabs, $this->getTabArray($this->community->getTimelines(true), 'channel')); $tab_tpl = Renderer::getMarkupTemplate('common_tabs.tpl'); $o .= Renderer::replaceMacros($tab_tpl, ['$tabs' => $tabs]); @@ -98,7 +110,7 @@ class Channel extends Timeline $this->page['aside'] .= Widget::accountTypes('channel/' . $this->selectedTab, $this->accountTypeString); - if (!in_array($this->selectedTab, [TimelineEntity::FOLLOWERS, TimelineEntity::FORYOU]) && $this->config->get('system', 'community_no_sharer')) { + if (!in_array($this->selectedTab, [ChannelEntity::FOLLOWERS, ChannelEntity::FORYOU]) && $this->config->get('system', 'community_no_sharer')) { $this->page['aside'] .= $this->getNoSharerWidget('channel'); } @@ -110,7 +122,7 @@ class Channel extends Timeline $o .= $this->conversation->statusEditor([], 0, true); } - if ($this->timeline->isChannel($this->selectedTab, $this->session->getLocalUserId())) { + if ($this->channel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) { $items = $this->getChannelItems(); $order = 'created'; } else { @@ -153,10 +165,10 @@ class Channel extends Timeline parent::parseRequest($request); if (!$this->selectedTab) { - $this->selectedTab = TimelineEntity::FORYOU; + $this->selectedTab = ChannelEntity::FORYOU; } - if (!$this->timeline->isChannel($this->selectedTab, $this->session->getLocalUserId()) && !$this->timeline->isCommunity($this->selectedTab)) { + if (!$this->channel->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/Community.php b/src/Module/Conversation/Community.php index 75f937d351..89af00043f 100644 --- a/src/Module/Conversation/Community.php +++ b/src/Module/Conversation/Community.php @@ -26,8 +26,8 @@ use Friendica\App; use Friendica\App\Mode; use Friendica\Content\BoundariesPager; use Friendica\Content\Conversation; -use Friendica\Content\Conversation\Entity\Timeline as TimelineEntity; -use Friendica\Content\Conversation\Factory\Timeline as TimelineFactory; +use Friendica\Content\Conversation\Entity\Community as CommunityEntity; +use Friendica\Content\Conversation\Factory\Community as CommunityFactory; use Friendica\Content\Conversation\Repository\Channel; use Friendica\Content\Feature; use Friendica\Content\Nav; @@ -61,8 +61,8 @@ class Community extends Timeline protected $pageStyle; - /** @var TimelineFactory */ - protected $timeline; + /** @var CommunityFactory */ + protected $community; /** @var Conversation */ protected $conversation; /** @var App\Page */ @@ -70,11 +70,11 @@ class Community extends Timeline /** @var SystemMessages */ protected $systemMessages; - public function __construct(Channel $channel, TimelineFactory $timeline, Conversation $conversation, App\Page $page, SystemMessages $systemMessages, 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 = []) + public function __construct(Channel $channel, CommunityFactory $community, Conversation $conversation, App\Page $page, SystemMessages $systemMessages, 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($channel, $mode, $session, $database, $pConfig, $config, $cache, $l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters); - $this->timeline = $timeline; + $this->community = $community; $this->conversation = $conversation; $this->page = $page; $this->systemMessages = $systemMessages; @@ -88,7 +88,7 @@ class Community extends Timeline $o = Renderer::replaceMacros($t, [ '$content' => '', '$header' => '', - '$show_global_community_hint' => ($this->selectedTab == TimelineEntity::GLOBAL) && $this->config->get('system', 'show_global_community_hint'), + '$show_global_community_hint' => ($this->selectedTab == CommunityEntity::GLOBAL) && $this->config->get('system', 'show_global_community_hint'), '$global_community_hint' => $this->l10n->t("This community stream shows all public posts received by this node. They may not reflect the opinions of this node’s users.") ]); @@ -98,7 +98,7 @@ class Community extends Timeline } if (empty($request['mode']) || ($request['mode'] != 'raw')) { - $tabs = $this->getTabArray($this->timeline->getCommunities($this->session->isAuthenticated()), 'community'); + $tabs = $this->getTabArray($this->community->getTimelines($this->session->isAuthenticated()), 'community'); $tab_tpl = Renderer::getMarkupTemplate('common_tabs.tpl'); $o .= Renderer::replaceMacros($tab_tpl, ['$tabs' => $tabs]); @@ -169,14 +169,14 @@ class Community extends Timeline if (!$this->selectedTab) { if (!empty($this->config->get('system', 'singleuser'))) { // On single user systems only the global page does make sense - $this->selectedTab = TimelineEntity::GLOBAL; + $this->selectedTab = CommunityEntity::GLOBAL; } else { // When only the global community is allowed, we use this as default - $this->selectedTab = $this->pageStyle == self::GLOBAL ? TimelineEntity::GLOBAL : TimelineEntity::LOCAL; + $this->selectedTab = $this->pageStyle == self::GLOBAL ? CommunityEntity::GLOBAL : CommunityEntity::LOCAL; } } - if (!$this->timeline->isCommunity($this->selectedTab)) { + if (!$this->community->isTimeline($this->selectedTab)) { throw new HTTPException\BadRequestException($this->l10n->t('Community option not available.')); } @@ -185,11 +185,11 @@ class Community extends Timeline $available = $this->pageStyle == self::LOCAL_AND_GLOBAL; if (!$available) { - $available = ($this->pageStyle == self::LOCAL) && ($this->selectedTab == TimelineEntity::LOCAL); + $available = ($this->pageStyle == self::LOCAL) && ($this->selectedTab == CommunityEntity::LOCAL); } if (!$available) { - $available = ($this->pageStyle == self::GLOBAL) && ($this->selectedTab == TimelineEntity::GLOBAL); + $available = ($this->pageStyle == self::GLOBAL) && ($this->selectedTab == CommunityEntity::GLOBAL); } if (!$available) { diff --git a/src/Module/Conversation/Network.php b/src/Module/Conversation/Network.php index 40a1b731b6..656c4410c3 100644 --- a/src/Module/Conversation/Network.php +++ b/src/Module/Conversation/Network.php @@ -25,9 +25,12 @@ use Friendica\App; use Friendica\App\Mode; use Friendica\Content\BoundariesPager; use Friendica\Content\Conversation; -use Friendica\Content\Conversation\Entity\Timeline as TimelineEntity; +use Friendica\Content\Conversation\Entity\Network as NetworkEntity; use Friendica\Content\Conversation\Factory\Timeline as TimelineFactory; use Friendica\Content\Conversation\Repository\Channel; +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\Feature; use Friendica\Content\GroupManager; use Friendica\Content\Nav; @@ -96,8 +99,14 @@ class Network extends Timeline protected $database; /** @var TimelineFactory */ protected $timeline; - - public function __construct(Channel $channel, App $app, TimelineFactory $timeline, SystemMessages $systemMessages, Mode $mode, Conversation $conversation, App\Page $page, 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 = []) + /** @var ChannelFactory */ + protected $channel; + /** @var CommunityFactory */ + protected $community; + /** @var NetworkFactory */ + protected $networkFactory; + + public function __construct(NetworkFactory $network, CommunityFactory $community, ChannelFactory $channelFactory, Channel $channel, App $app, TimelineFactory $timeline, SystemMessages $systemMessages, Mode $mode, Conversation $conversation, App\Page $page, 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($channel, $mode, $session, $database, $pConfig, $config, $cache, $l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters); @@ -106,6 +115,9 @@ class Network extends Timeline $this->systemMessages = $systemMessages; $this->conversation = $conversation; $this->page = $page; + $this->channel = $channelFactory; + $this->community = $community; + $this->networkFactory = $network; } protected function content(array $request = []): string @@ -123,9 +135,9 @@ class Network extends Timeline $o = ''; - if ($this->timeline->isChannel($this->selectedTab, $this->session->getLocalUserId())) { + if ($this->channel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) { $items = $this->getChannelItems(); - } elseif ($this->timeline->isCommunity($this->selectedTab)) { + } elseif ($this->community->isTimeline($this->selectedTab)) { $items = $this->getCommunityItems(); } else { $items = $this->getItems(); @@ -266,12 +278,12 @@ class Network extends Timeline */ private function getTabsHTML() { - $tabs = $this->getTabArray($this->timeline->getNetworkFeeds($this->args->getCommand()), 'network'); + $tabs = $this->getTabArray($this->networkFactory->getTimelines($this->args->getCommand()), 'network'); $network_timelines = $this->pConfig->get($this->session->getLocalUserId(), 'system', 'network_timelines', []); if (!empty($network_timelines)) { - $tabs = array_merge($tabs, $this->getTabArray($this->timeline->getChannelsForUser($this->session->getLocalUserId()), 'network', 'channel')); - $tabs = array_merge($tabs, $this->getTabArray($this->timeline->getCommunities(true), 'network', 'channel')); + $tabs = array_merge($tabs, $this->getTabArray($this->channel->getForUser($this->session->getLocalUserId()), 'network', 'channel')); + $tabs = array_merge($tabs, $this->getTabArray($this->community->getTimelines(true), 'network', 'channel')); } $arr = ['tabs' => $tabs]; @@ -304,26 +316,26 @@ class Network extends Timeline if (!$this->selectedTab) { $this->selectedTab = self::getTimelineOrderBySession($this->session, $this->pConfig); - } elseif (!$this->timeline->isNetwork($this->selectedTab) && !$this->timeline->isChannel($this->selectedTab, $this->session->getLocalUserId()) && !$this->timeline->isCommunity($this->selectedTab)) { + } elseif (!$this->networkFactory->isTimeline($this->selectedTab) && !$this->channel->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->timeline->isChannel($this->selectedTab, $this->session->getLocalUserId()) || $this->timeline->isCommunity($this->selectedTab))) { - $this->selectedTab = TimelineEntity::RECEIVED; + if (($this->network || $this->circleId || $this->groupContactId) && ($this->channel->isTimeline($this->selectedTab, $this->session->getLocalUserId()) || $this->community->isTimeline($this->selectedTab))) { + $this->selectedTab = NetworkEntity::RECEIVED; } if (!empty($request['star'])) { - $this->selectedTab = TimelineEntity::STAR; + $this->selectedTab = NetworkEntity::STAR; $this->star = true; } else { - $this->star = $this->selectedTab == TimelineEntity::STAR; + $this->star = $this->selectedTab == NetworkEntity::STAR; } if (!empty($request['mention'])) { - $this->selectedTab = TimelineEntity::MENTION; + $this->selectedTab = NetworkEntity::MENTION; $this->mention = true; } else { - $this->mention = $this->selectedTab == TimelineEntity::MENTION; + $this->mention = $this->selectedTab == NetworkEntity::MENTION; } if (!empty($request['order'])) { @@ -331,9 +343,9 @@ class Network extends Timeline $this->order = $request['order']; $this->star = false; $this->mention = false; - } elseif (in_array($this->selectedTab, [TimelineEntity::RECEIVED, TimelineEntity::STAR]) || $this->timeline->isCommunity($this->selectedTab)) { + } elseif (in_array($this->selectedTab, [NetworkEntity::RECEIVED, NetworkEntity::STAR]) || $this->community->isTimeline($this->selectedTab)) { $this->order = 'received'; - } elseif (($this->selectedTab == TimelineEntity::CREATED) || $this->timeline->isChannel($this->selectedTab, $this->session->getLocalUserId())) { + } elseif (($this->selectedTab == NetworkEntity::CREATED) || $this->channel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) { $this->order = 'created'; } else { $this->order = 'commented'; @@ -343,16 +355,16 @@ class Network extends Timeline // Upon updates in the background and order by last comment we order by received date, // since otherwise the feed will optically jump, when some already visible thread has been updated. - if ($this->update && ($this->selectedTab == TimelineEntity::COMMENTED)) { + if ($this->update && ($this->selectedTab == NetworkEntity::COMMENTED)) { $this->order = 'received'; $request['last_received'] = $request['last_commented'] ?? null; $request['first_received'] = $request['first_commented'] ?? null; } // Prohibit combined usage of "star" and "mention" - if ($this->selectedTab == TimelineEntity::STAR) { + if ($this->selectedTab == NetworkEntity::STAR) { $this->mention = false; - } elseif ($this->selectedTab == TimelineEntity::MENTION) { + } elseif ($this->selectedTab == NetworkEntity::MENTION) { $this->star = false; } diff --git a/src/Module/Conversation/Timeline.php b/src/Module/Conversation/Timeline.php index 2ee98527b2..3f7f3ef759 100644 --- a/src/Module/Conversation/Timeline.php +++ b/src/Module/Conversation/Timeline.php @@ -25,7 +25,7 @@ use Friendica\App; use Friendica\App\Mode; use Friendica\BaseModule; use Friendica\Content\Conversation\Collection\Timelines; -use Friendica\Content\Conversation\Entity\Timeline as TimelineEntity; +use Friendica\Content\Conversation\Entity\Channel as ChannelEntity; use Friendica\Content\Conversation\Repository\Channel; use Friendica\Core\Cache\Capability\ICanCache; use Friendica\Core\Cache\Enum\Duration; @@ -269,13 +269,13 @@ class Timeline extends BaseModule { $uid = $this->session->getLocalUserId(); - if ($this->selectedTab == TimelineEntity::WHATSHOT) { + if ($this->selectedTab == ChannelEntity::WHATSHOT) { if (!is_null($this->accountType)) { $condition = ["(`comments` > ? OR `activities` > ?) AND `contact-type` = ?", $this->getMedianComments($uid, 4), $this->getMedianActivities($uid, 4), $this->accountType]; } else { $condition = ["(`comments` > ? OR `activities` > ?) AND `contact-type` != ?", $this->getMedianComments($uid, 4), $this->getMedianActivities($uid, 4), Contact::TYPE_COMMUNITY]; } - } elseif ($this->selectedTab == TimelineEntity::FORYOU) { + } elseif ($this->selectedTab == ChannelEntity::FORYOU) { $cid = Contact::getPublicIdByUserId($uid); $condition = [ @@ -285,9 +285,9 @@ class Timeline extends BaseModule $cid, $this->getMedianRelationThreadScore($cid, 4), $this->getMedianComments($uid, 4), $this->getMedianActivities($uid, 4), $cid, $uid, Contact\User::FREQUENCY_ALWAYS ]; - } elseif ($this->selectedTab == TimelineEntity::FOLLOWERS) { + } elseif ($this->selectedTab == ChannelEntity::FOLLOWERS) { $condition = ["`owner-id` IN (SELECT `pid` FROM `account-user-view` WHERE `uid` = ? AND `rel` = ?)", $uid, Contact::FOLLOWER]; - } elseif ($this->selectedTab == TimelineEntity::SHARERSOFSHARERS) { + } elseif ($this->selectedTab == ChannelEntity::SHARERSOFSHARERS) { $cid = Contact::getPublicIdByUserId($uid); // @todo Suggest posts from contacts that are followed most by our followers @@ -297,19 +297,19 @@ class Timeline extends BaseModule AND NOT `cid` IN (SELECT `cid` FROM `contact-relation` WHERE `follows` AND `relation-cid` = ?))", DateTimeFormat::utc('now - ' . $this->config->get('channel', 'sharer_interaction_days') . ' day'), $cid, $this->getMedianRelationThreadScore($cid, 4), $cid ]; - } elseif ($this->selectedTab == TimelineEntity::IMAGE) { + } elseif ($this->selectedTab == ChannelEntity::IMAGE) { $condition = ["`media-type` & ?", 1]; - } elseif ($this->selectedTab == TimelineEntity::VIDEO) { + } elseif ($this->selectedTab == ChannelEntity::VIDEO) { $condition = ["`media-type` & ?", 2]; - } elseif ($this->selectedTab == TimelineEntity::AUDIO) { + } elseif ($this->selectedTab == ChannelEntity::AUDIO) { $condition = ["`media-type` & ?", 4]; - } elseif ($this->selectedTab == TimelineEntity::LANGUAGE) { + } elseif ($this->selectedTab == ChannelEntity::LANGUAGE) { $condition = ["JSON_EXTRACT(JSON_KEYS(language), '$[0]') = ?", $this->l10n->convertCodeForLanguageDetection(User::getLanguageCode($uid))]; } elseif (is_numeric($this->selectedTab)) { $condition = $this->getUserChannelConditions($this->selectedTab, $this->session->getLocalUserId()); } - if ($this->selectedTab != TimelineEntity::LANGUAGE) { + if ($this->selectedTab != ChannelEntity::LANGUAGE) { $condition = $this->addLanguageCondition($uid, $condition); } @@ -317,7 +317,7 @@ class Timeline extends BaseModule $condition = DBA::mergeConditions($condition, ["NOT EXISTS(SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND `cid` = `post-engagement`.`owner-id` AND (`ignored` OR `blocked` OR `collapsed` OR `is-blocked` OR `channel-frequency` = ?))", $uid, Contact\User::FREQUENCY_NEVER]); - if (($this->selectedTab != TimelineEntity::WHATSHOT) && !is_null($this->accountType)) { + if (($this->selectedTab != ChannelEntity::WHATSHOT) && !is_null($this->accountType)) { $condition = DBA::mergeConditions($condition, ['contact-type' => $this->accountType]); } diff --git a/src/Module/Settings/Display.php b/src/Module/Settings/Display.php index 44be88ec15..3c5311482f 100644 --- a/src/Module/Settings/Display.php +++ b/src/Module/Settings/Display.php @@ -24,6 +24,9 @@ namespace Friendica\Module\Settings; use Friendica\App; use Friendica\Content\Conversation\Collection\Timelines; use Friendica\Content\Text\BBCode; +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\Timeline as TimelineFactory; use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\Hook; @@ -53,10 +56,16 @@ class Display extends BaseSettings private $app; /** @var SystemMessages */ private $systemMessages; + /** @var ChannelFactory */ + protected $channel; + /** @var CommunityFactory */ + protected $community; + /** @var NetworkFactory */ + protected $network; /** @var TimelineFactory */ protected $timeline; - public function __construct(TimelineFactory $timeline, SystemMessages $systemMessages, App $app, IManagePersonalConfigValues $pConfig, IManageConfigValues $config, IHandleUserSessions $session, App\Page $page, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = []) + public function __construct(NetworkFactory $network, CommunityFactory $community, ChannelFactory $channel, TimelineFactory $timeline, SystemMessages $systemMessages, App $app, IManagePersonalConfigValues $pConfig, IManageConfigValues $config, IHandleUserSessions $session, App\Page $page, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = []) { parent::__construct($session, $page, $l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters); @@ -65,6 +74,9 @@ class Display extends BaseSettings $this->app = $app; $this->systemMessages = $systemMessages; $this->timeline = $timeline; + $this->channel = $channel; + $this->community = $community; + $this->network = $network; } protected function post(array $request = []) @@ -329,7 +341,7 @@ class Display extends BaseSettings { $timelines = []; - foreach ($this->timeline->getNetworkFeeds('') as $channel) { + foreach ($this->network->getTimelines('') as $channel) { $timelines[] = $channel; } @@ -337,11 +349,11 @@ class Display extends BaseSettings return new Timelines($timelines); } - foreach ($this->timeline->getChannelsForUser($uid) as $channel) { + foreach ($this->channel->getForUser($uid) as $channel) { $timelines[] = $channel; } - foreach ($this->timeline->getCommunities(true) as $community) { + foreach ($this->community->getTimelines(true) as $community) { $timelines[] = $community; } diff --git a/src/Module/Update/Channel.php b/src/Module/Update/Channel.php index 0abe036d6f..2cff325850 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->timeline->isChannel($this->selectedTab, $this->session->getLocalUserId())) { + if ($this->channel->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 612d4079c8..140900876d 100644 --- a/src/Module/Update/Network.php +++ b/src/Module/Update/Network.php @@ -41,9 +41,9 @@ class Network extends NetworkModule System::htmlUpdateExit($o); } - if ($this->timeline->isChannel($this->selectedTab, $this->session->getLocalUserId())) { + if ($this->channel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) { $items = $this->getChannelItems(); - } elseif ($this->timeline->isCommunity($this->selectedTab)) { + } elseif ($this->community->isTimeline($this->selectedTab)) { $items = $this->getCommunityItems(); } else { $items = $this->getItems();