diff --git a/src/Content/Nav.php b/src/Content/Nav.php index cac03ccaad..cab5f7a425 100644 --- a/src/Content/Nav.php +++ b/src/Content/Nav.php @@ -284,14 +284,12 @@ class Nav $gdirpath = Profile::zrl($this->config->get('system', 'directory'), true); } - if ((!$this->session->isAuthenticated() && $this->config->get('system', 'community_page_style') != Community::DISABLED_VISITOR) && - !($this->config->get('system', 'community_page_style') == Community::DISABLED) - ) { + if (($this->session->getLocalUserId() || $this->config->get('system', 'community_page_style') != Community::DISABLED_VISITOR) && + !($this->config->get('system', 'community_page_style') == Community::DISABLED)) { $nav['community'] = ['community', $this->l10n->t('Community'), '', $this->l10n->t('Conversations on this and other servers')]; } if ($this->session->getLocalUserId()) { - $nav['channel'] = ['channel', $this->l10n->t('Channels'), '', $this->l10n->t('Current posts, filtered by several rules')]; $nav['calendar'] = ['calendar', $this->l10n->t('Calendar'), '', $this->l10n->t('Calendar')]; } diff --git a/src/Content/Widget.php b/src/Content/Widget.php index ce4548d1ad..1f73f04495 100644 --- a/src/Content/Widget.php +++ b/src/Content/Widget.php @@ -547,4 +547,35 @@ class Widget $accounttype ); } + + /** + * Get a list of all channels + * + * @param string $base + * @param string $channelname + * @param integer $uid + * @return string + */ + public static function channels(string $base, string $channelname, int $uid): string + { + $channels = []; + + foreach (DI::TimelineFactory()->getChannelsForUser($uid) as $channel) { + $channels[] = ['ref' => $channel->code, 'name' => $channel->label]; + } + + foreach (DI::TimelineFactory()->getCommunities(true) as $community) { + $channels[] = ['ref' => $community->code, 'name' => $community->label]; + } + + return self::filter( + 'channel', + DI::l10n()->t('Channels'), + '', + '', + $base, + $channels, + $channelname + ); + } } diff --git a/src/DI.php b/src/DI.php index 2d6eb6ede4..681c8fcbc1 100644 --- a/src/DI.php +++ b/src/DI.php @@ -547,6 +547,14 @@ abstract class DI return self::$dice->create(Contact\FriendSuggest\Factory\FriendSuggest::class); } + /** + * @return Content\Conversation\Factory\Timeline + */ + public static function TimelineFactory() + { + return self::$dice->create(Content\Conversation\Factory\Timeline::class); + } + /** * @return Contact\Introduction\Repository\Introduction */ diff --git a/src/Module/Conversation/Network.php b/src/Module/Conversation/Network.php index c2ab24297e..8041a3309f 100644 --- a/src/Module/Conversation/Network.php +++ b/src/Module/Conversation/Network.php @@ -117,6 +117,7 @@ class Network extends Timeline $module = 'network'; + $this->page['aside'] .= Widget::channels($module, $this->selectedTab, $this->session->getLocalUserId()); $this->page['aside'] .= Widget::accountTypes($module, $this->accountTypeString); $arr = ['query' => $this->args->getQueryString()]; diff --git a/view/templates/widget/filter.tpl b/view/templates/widget/filter.tpl index 85a3298f56..5bde685492 100644 --- a/view/templates/widget/filter.tpl +++ b/view/templates/widget/filter.tpl @@ -7,7 +7,9 @@
{{$desc nofilter}}