]> git.mxchange.org Git - friendica.git/commitdiff
We now display the channel in the sidebar
authorMichael <heluecht@pirati.ca>
Sat, 9 Sep 2023 19:30:01 +0000 (19:30 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 9 Sep 2023 19:30:01 +0000 (19:30 +0000)
src/Content/Nav.php
src/Content/Widget.php
src/DI.php
src/Module/Conversation/Network.php
view/templates/widget/filter.tpl
view/theme/quattro/templates/widget/filter.tpl

index cac03ccaad2bae32c56fb93a55d5e5699c6f2961..cab5f7a4250ac3a77a96afd5e2e6d530eed02cb4 100644 (file)
@@ -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')];
                }
 
index ce4548d1ad02ea73ba42e39d7292f6c4414da82a..1f73f0449591d1fc8746e4b662dfcf2e1965a705 100644 (file)
@@ -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
+               );
+       }
 }
index 2d6eb6ede4352543ad40fada57f56850b9259402..681c8fcbc168ecba0f07e606a00f92de56b6cfa4 100644 (file)
@@ -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
         */
index c2ab24297e8eb1a4f62190d6a96e65f44e149368..8041a3309ff7fafce6d73e87851bcddc1d865365 100644 (file)
@@ -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()];
index 85a3298f567738f5dcec1bc9b4715ff7428058fc..5bde685492faf2f78197d176424f5d4ec6765531 100644 (file)
@@ -7,7 +7,9 @@
        </span>
        <div id="{{$type}}-desc">{{$desc nofilter}}</div>
        <ul role="menu" class="{{$type}}-ul">
+               {{if !$all_label}}
                <li role="menuitem" {{if !is_null($selected) && !$selected}}class="selected"{{/if}}><a href="{{$base}}" class="{{$type}}-link{{if !$selected}} {{$type}}-selected{{/if}} {{$type}}-all">{{$all_label}}</a></li>
+               {{/if}}
                {{foreach $options as $option}}
                        <li role="menuitem" {{if $selected == $option.ref}}class="selected"{{/if}}><a href="{{$base}}{{$type}}={{$option.ref}}" class="{{$type}}-link{{if $selected == $option.ref}} {{$type}}-selected{{/if}}">{{$option.name}}</a></li>
                {{/foreach}}
index 8a44beccbbed2024b39b41f61e15011303ddd193..63f0277dd371b73d3a9d76af0046d2ad9ea0bc5c 100644 (file)
@@ -5,7 +5,9 @@
 {{/if}}
        
        <ul class="{{$type}}-ul">
+               {{if !$all_label}}
                <li class="tool {{if !$selected}}selected{{/if}}"><a href="{{$base}}" class="{{$type}}-link {{$type}}-all">{{$all_label}}</a>
+               {{/if}}
 {{foreach $options as $option}}
                <li class="tool {{if $selected == $option.ref}}selected{{/if}}"><a href="{{$base}}{{$type}}={{$option.ref}}" class="{{$type}}-link">{{$option.name}}</a></li>
 {{/foreach}}