Clean channel confusion
This commit is contained in:
parent
134cbacf31
commit
3f6480c127
|
@ -35,13 +35,13 @@ class Timeline extends \Friendica\BaseFactory implements ICanCreateFromTableRow
|
|||
/** @var IManageConfigValues The config */
|
||||
protected $config;
|
||||
/** @var Channel */
|
||||
protected $channel;
|
||||
protected $channelRepository;
|
||||
|
||||
public function __construct(Channel $channel, L10n $l10n, LoggerInterface $logger, IManageConfigValues $config)
|
||||
{
|
||||
parent::__construct($logger);
|
||||
|
||||
$this->channel = $channel;
|
||||
$this->channelRepository = $channel;
|
||||
$this->l10n = $l10n;
|
||||
$this->config = $config;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ final class UserDefinedChannel extends Timeline
|
|||
*/
|
||||
public function getForUser(int $uid): Timelines
|
||||
{
|
||||
foreach ($this->channel->selectByUid($uid) as $channel) {
|
||||
foreach ($this->channelRepository->selectByUid($uid) as $channel) {
|
||||
$tabs[] = $channel;
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,6 @@ final class UserDefinedChannel extends Timeline
|
|||
|
||||
public function isTimeline(string $selectedTab, int $uid): bool
|
||||
{
|
||||
return is_numeric($selectedTab) && $uid && $this->channel->existsById($selectedTab, $uid);
|
||||
return is_numeric($selectedTab) && $uid && $this->channelRepository->existsById($selectedTab, $uid);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@ use Friendica\Content\Conversation\Repository\Channel as ChannelRepository;
|
|||
use Friendica\Content\Conversation\Factory\Channel as ChannelFactory;
|
||||
use Friendica\Content\Conversation\Factory\Community as CommunityFactory;
|
||||
use Friendica\Content\Conversation\Factory\Network as NetworkFactory;
|
||||
use Friendica\Content\Conversation\Factory\UserDefinedChannel;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Content\Text\HTML;
|
||||
|
@ -63,7 +62,7 @@ class Channel extends Timeline
|
|||
/** @var SystemMessages */
|
||||
protected $systemMessages;
|
||||
/** @var ChannelFactory */
|
||||
protected $channelFactory;
|
||||
protected $channel;
|
||||
/** @var UserDefinedChannelFactory */
|
||||
protected $userDefinedChannel;
|
||||
/** @var CommunityFactory */
|
||||
|
@ -79,7 +78,7 @@ class Channel extends Timeline
|
|||
$this->conversation = $conversation;
|
||||
$this->page = $page;
|
||||
$this->systemMessages = $systemMessages;
|
||||
$this->channelFactory = $channelFactory;
|
||||
$this->channel = $channelFactory;
|
||||
$this->community = $community;
|
||||
$this->networkFactory = $network;
|
||||
$this->userDefinedChannel = $userDefinedChannel;
|
||||
|
@ -105,7 +104,7 @@ class Channel extends Timeline
|
|||
}
|
||||
|
||||
if (empty($request['mode']) || ($request['mode'] != 'raw')) {
|
||||
$tabs = $this->getTabArray($this->channelFactory->getTimelines($this->session->getLocalUserId()), 'channel');
|
||||
$tabs = $this->getTabArray($this->channel->getTimelines($this->session->getLocalUserId()), 'channel');
|
||||
$tabs = array_merge($tabs, $this->getTabArray($this->userDefinedChannel->getForUser($this->session->getLocalUserId()), 'channel'));
|
||||
$tabs = array_merge($tabs, $this->getTabArray($this->community->getTimelines(true), 'channel'));
|
||||
|
||||
|
@ -128,7 +127,7 @@ class Channel extends Timeline
|
|||
$o .= $this->conversation->statusEditor([], 0, true);
|
||||
}
|
||||
|
||||
if ($this->channelFactory->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
|
||||
if ($this->channel->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
|
||||
$items = $this->getChannelItems();
|
||||
$order = 'created';
|
||||
} else {
|
||||
|
@ -174,7 +173,7 @@ class Channel extends Timeline
|
|||
$this->selectedTab = ChannelEntity::FORYOU;
|
||||
}
|
||||
|
||||
if (!$this->channelFactory->isTimeline($this->selectedTab) && !$this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId()) && !$this->community->isTimeline($this->selectedTab)) {
|
||||
if (!$this->channel->isTimeline($this->selectedTab) && !$this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId()) && !$this->community->isTimeline($this->selectedTab)) {
|
||||
throw new HTTPException\BadRequestException($this->l10n->t('Channel not available.'));
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ class Network extends Timeline
|
|||
/** @var TimelineFactory */
|
||||
protected $timeline;
|
||||
/** @var ChannelFactory */
|
||||
protected $channelFactory;
|
||||
protected $channel;
|
||||
/** @var UserDefinedChannelFactory */
|
||||
protected $userDefinedChannel;
|
||||
/** @var CommunityFactory */
|
||||
|
@ -118,7 +118,7 @@ class Network extends Timeline
|
|||
$this->systemMessages = $systemMessages;
|
||||
$this->conversation = $conversation;
|
||||
$this->page = $page;
|
||||
$this->channelFactory = $channelFactory;
|
||||
$this->channel = $channelFactory;
|
||||
$this->community = $community;
|
||||
$this->networkFactory = $network;
|
||||
$this->userDefinedChannel = $userDefinedChannel;
|
||||
|
@ -139,7 +139,7 @@ class Network extends Timeline
|
|||
|
||||
$o = '';
|
||||
|
||||
if ($this->channelFactory->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
|
||||
if ($this->channel->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
|
||||
$items = $this->getChannelItems();
|
||||
} elseif ($this->community->isTimeline($this->selectedTab)) {
|
||||
$items = $this->getCommunityItems();
|
||||
|
@ -286,7 +286,7 @@ class Network extends Timeline
|
|||
|
||||
$network_timelines = $this->pConfig->get($this->session->getLocalUserId(), 'system', 'network_timelines', []);
|
||||
if (!empty($network_timelines)) {
|
||||
$tabs = array_merge($tabs, $this->getTabArray($this->channelFactory->getTimelines($this->session->getLocalUserId()), 'network', 'channel'));
|
||||
$tabs = array_merge($tabs, $this->getTabArray($this->channel->getTimelines($this->session->getLocalUserId()), 'network', 'channel'));
|
||||
$tabs = array_merge($tabs, $this->getTabArray($this->userDefinedChannel->getForUser($this->session->getLocalUserId()), 'network', 'channel'));
|
||||
$tabs = array_merge($tabs, $this->getTabArray($this->community->getTimelines(true), 'network', 'channel'));
|
||||
}
|
||||
|
@ -321,11 +321,11 @@ class Network extends Timeline
|
|||
|
||||
if (!$this->selectedTab) {
|
||||
$this->selectedTab = self::getTimelineOrderBySession($this->session, $this->pConfig);
|
||||
} elseif (!$this->networkFactory->isTimeline($this->selectedTab) && !$this->channelFactory->isTimeline($this->selectedTab) && !$this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId()) && !$this->community->isTimeline($this->selectedTab)) {
|
||||
} elseif (!$this->networkFactory->isTimeline($this->selectedTab) && !$this->channel->isTimeline($this->selectedTab) && !$this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId()) && !$this->community->isTimeline($this->selectedTab)) {
|
||||
throw new HTTPException\BadRequestException($this->l10n->t('Network feed not available.'));
|
||||
}
|
||||
|
||||
if (($this->network || $this->circleId || $this->groupContactId) && ($this->channelFactory->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId()) || $this->community->isTimeline($this->selectedTab))) {
|
||||
if (($this->network || $this->circleId || $this->groupContactId) && ($this->channel->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId()) || $this->community->isTimeline($this->selectedTab))) {
|
||||
$this->selectedTab = NetworkEntity::RECEIVED;
|
||||
}
|
||||
|
||||
|
@ -350,7 +350,7 @@ class Network extends Timeline
|
|||
$this->mention = false;
|
||||
} elseif (in_array($this->selectedTab, [NetworkEntity::RECEIVED, NetworkEntity::STAR]) || $this->community->isTimeline($this->selectedTab)) {
|
||||
$this->order = 'received';
|
||||
} elseif (($this->selectedTab == NetworkEntity::CREATED) || $this->channelFactory->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
|
||||
} elseif (($this->selectedTab == NetworkEntity::CREATED) || $this->channel->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
|
||||
$this->order = 'created';
|
||||
} else {
|
||||
$this->order = 'commented';
|
||||
|
|
|
@ -81,13 +81,13 @@ class Timeline extends BaseModule
|
|||
/** @var ICanCache */
|
||||
protected $cache;
|
||||
/** @var Channel */
|
||||
protected $channel;
|
||||
protected $channelRepository;
|
||||
|
||||
public function __construct(Channel $channel, Mode $mode, IHandleUserSessions $session, Database $database, IManagePersonalConfigValues $pConfig, IManageConfigValues $config, ICanCache $cache, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
|
||||
{
|
||||
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
||||
|
||||
$this->channel = $channel;
|
||||
$this->channelRepository = $channel;
|
||||
$this->mode = $mode;
|
||||
$this->session = $session;
|
||||
$this->database = $database;
|
||||
|
@ -368,7 +368,7 @@ class Timeline extends BaseModule
|
|||
|
||||
private function getUserChannelConditions(int $id, int $uid): array
|
||||
{
|
||||
$channel = $this->channel->selectById($id, $uid);
|
||||
$channel = $this->channelRepository->selectById($id, $uid);
|
||||
if (empty($channel)) {
|
||||
return [];
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ class Channel extends ChannelModule
|
|||
|
||||
$o = '';
|
||||
if ($this->update || $this->force) {
|
||||
if ($this->channelFactory->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
|
||||
if ($this->channel->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
|
||||
$items = $this->getChannelItems();
|
||||
} else {
|
||||
$items = $this->getCommunityItems();
|
||||
|
|
|
@ -41,7 +41,7 @@ class Network extends NetworkModule
|
|||
System::htmlUpdateExit($o);
|
||||
}
|
||||
|
||||
if ($this->channelFactory->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
|
||||
if ($this->channel->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
|
||||
$items = $this->getChannelItems();
|
||||
} elseif ($this->community->isTimeline($this->selectedTab)) {
|
||||
$items = $this->getCommunityItems();
|
||||
|
|
Loading…
Reference in New Issue
Block a user