]> git.mxchange.org Git - friendica.git/commitdiff
Show network elements in the channel widget
authorMichael <heluecht@pirati.ca>
Tue, 19 Sep 2023 10:20:15 +0000 (10:20 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 19 Sep 2023 10:20:15 +0000 (10:20 +0000)
src/Content/Conversation/Factory/Timeline.php
src/Content/Widget.php
src/Module/Conversation/Network.php

index 0e4c0b76d6a7761a0171140fdecf737bd204bbad..2a6e12330f8a4c0e1c30d5903eedf1e81dcb2e01 100644 (file)
@@ -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]);
index 1f73f0449591d1fc8746e4b662dfcf2e1965a705..486bada7d5c87efe0155fc41646ee823f72210c0 100644 (file)
@@ -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];
                }
index 095b2ccebe72dacec6c4d2476f69aa3604763c31..c05a06d393cd4eb948c2377f2d9d25a637d86d57 100644 (file)
@@ -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.'));
                }