We now display the channel in the sidebar

This commit is contained in:
Michael 2023-09-09 19:30:01 +00:00
parent d395de3aa1
commit 8050389d32
6 changed files with 46 additions and 4 deletions

View file

@ -284,14 +284,12 @@ class Nav
$gdirpath = Profile::zrl($this->config->get('system', 'directory'), true); $gdirpath = Profile::zrl($this->config->get('system', 'directory'), true);
} }
if ((!$this->session->isAuthenticated() && $this->config->get('system', 'community_page_style') != Community::DISABLED_VISITOR) && if (($this->session->getLocalUserId() || $this->config->get('system', 'community_page_style') != Community::DISABLED_VISITOR) &&
!($this->config->get('system', 'community_page_style') == Community::DISABLED) !($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')]; $nav['community'] = ['community', $this->l10n->t('Community'), '', $this->l10n->t('Conversations on this and other servers')];
} }
if ($this->session->getLocalUserId()) { 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')]; $nav['calendar'] = ['calendar', $this->l10n->t('Calendar'), '', $this->l10n->t('Calendar')];
} }

View file

@ -547,4 +547,35 @@ class Widget
$accounttype $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
);
}
} }

View file

@ -547,6 +547,14 @@ abstract class DI
return self::$dice->create(Contact\FriendSuggest\Factory\FriendSuggest::class); 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 * @return Contact\Introduction\Repository\Introduction
*/ */

View file

@ -117,6 +117,7 @@ class Network extends Timeline
$module = 'network'; $module = 'network';
$this->page['aside'] .= Widget::channels($module, $this->selectedTab, $this->session->getLocalUserId());
$this->page['aside'] .= Widget::accountTypes($module, $this->accountTypeString); $this->page['aside'] .= Widget::accountTypes($module, $this->accountTypeString);
$arr = ['query' => $this->args->getQueryString()]; $arr = ['query' => $this->args->getQueryString()];

View file

@ -7,7 +7,9 @@
</span> </span>
<div id="{{$type}}-desc">{{$desc nofilter}}</div> <div id="{{$type}}-desc">{{$desc nofilter}}</div>
<ul role="menu" class="{{$type}}-ul"> <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> <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}} {{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> <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}} {{/foreach}}

View file

@ -5,7 +5,9 @@
{{/if}} {{/if}}
<ul class="{{$type}}-ul"> <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> <li class="tool {{if !$selected}}selected{{/if}}"><a href="{{$base}}" class="{{$type}}-link {{$type}}-all">{{$all_label}}</a>
{{/if}}
{{foreach $options as $option}} {{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> <li class="tool {{if $selected == $option.ref}}selected{{/if}}"><a href="{{$base}}{{$type}}={{$option.ref}}" class="{{$type}}-link">{{$option.name}}</a></li>
{{/foreach}} {{/foreach}}