Show network elements in the channel widget
This commit is contained in:
parent
00eb6b01ff
commit
5056c95d60
3 changed files with 10 additions and 1 deletions
|
@ -134,6 +134,11 @@ final class Timeline extends \Friendica\BaseFactory implements ICanCreateFromTab
|
||||||
return new Timelines($tabs);
|
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
|
public function isCommunity(string $selectedTab): bool
|
||||||
{
|
{
|
||||||
return in_array($selectedTab, [TimelineEntity::LOCAL, TimelineEntity::GLOBAL]);
|
return in_array($selectedTab, [TimelineEntity::LOCAL, TimelineEntity::GLOBAL]);
|
||||||
|
|
|
@ -560,6 +560,10 @@ class Widget
|
||||||
{
|
{
|
||||||
$channels = [];
|
$channels = [];
|
||||||
|
|
||||||
|
foreach (DI::TimelineFactory()->getNetworkFeeds('') as $channel) {
|
||||||
|
$channels[] = ['ref' => $channel->code, 'name' => $channel->label];
|
||||||
|
}
|
||||||
|
|
||||||
foreach (DI::TimelineFactory()->getChannelsForUser($uid) as $channel) {
|
foreach (DI::TimelineFactory()->getChannelsForUser($uid) as $channel) {
|
||||||
$channels[] = ['ref' => $channel->code, 'name' => $channel->label];
|
$channels[] = ['ref' => $channel->code, 'name' => $channel->label];
|
||||||
}
|
}
|
||||||
|
|
|
@ -313,7 +313,7 @@ class Network extends Timeline
|
||||||
|
|
||||||
if (!$this->selectedTab) {
|
if (!$this->selectedTab) {
|
||||||
$this->selectedTab = self::getTimelineOrderBySession($this->session, $this->pConfig);
|
$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.'));
|
throw new HTTPException\BadRequestException($this->l10n->t('Network feed not available.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue