From: Michael Date: Tue, 19 Sep 2023 10:20:15 +0000 (+0000) Subject: Show network elements in the channel widget X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5056c95d60a3e2e891ab1da0196d52d2c8f80712;p=friendica.git Show network elements in the channel widget --- diff --git a/src/Content/Conversation/Factory/Timeline.php b/src/Content/Conversation/Factory/Timeline.php index 0e4c0b76d6..2a6e12330f 100644 --- a/src/Content/Conversation/Factory/Timeline.php +++ b/src/Content/Conversation/Factory/Timeline.php @@ -134,6 +134,11 @@ final class Timeline extends \Friendica\BaseFactory implements ICanCreateFromTab 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]); diff --git a/src/Content/Widget.php b/src/Content/Widget.php index 1f73f04495..486bada7d5 100644 --- a/src/Content/Widget.php +++ b/src/Content/Widget.php @@ -560,6 +560,10 @@ class Widget { $channels = []; + foreach (DI::TimelineFactory()->getNetworkFeeds('') as $channel) { + $channels[] = ['ref' => $channel->code, 'name' => $channel->label]; + } + foreach (DI::TimelineFactory()->getChannelsForUser($uid) as $channel) { $channels[] = ['ref' => $channel->code, 'name' => $channel->label]; } diff --git a/src/Module/Conversation/Network.php b/src/Module/Conversation/Network.php index 095b2ccebe..c05a06d393 100644 --- a/src/Module/Conversation/Network.php +++ b/src/Module/Conversation/Network.php @@ -313,7 +313,7 @@ class Network extends Timeline if (!$this->selectedTab) { $this->selectedTab = self::getTimelineOrderBySession($this->session, $this->pConfig); - } elseif (!$this->timeline->isChannel($this->selectedTab, $this->session->getLocalUserId()) && !$this->timeline->isCommunity($this->selectedTab)) { + } elseif (!$this->timeline->isNetwork($this->selectedTab) && !$this->timeline->isChannel($this->selectedTab, $this->session->getLocalUserId()) && !$this->timeline->isCommunity($this->selectedTab)) { throw new HTTPException\BadRequestException($this->l10n->t('Network feed not available.')); }