Channel class confusion solved
This commit is contained in:
parent
ed24d06e0c
commit
22e0bb58d9
6 changed files with 17 additions and 17 deletions
|
@ -22,6 +22,7 @@
|
||||||
namespace Friendica\Content\Conversation\Repository;
|
namespace Friendica\Content\Conversation\Repository;
|
||||||
|
|
||||||
use Friendica\BaseCollection;
|
use Friendica\BaseCollection;
|
||||||
|
use Friendica\Content\Conversation\Entity\Timeline as TimelineEntity;
|
||||||
use Friendica\Content\Conversation\Entity\UserDefinedChannel;
|
use Friendica\Content\Conversation\Entity\UserDefinedChannel;
|
||||||
use Friendica\Content\Conversation\Factory\Timeline;
|
use Friendica\Content\Conversation\Factory\Timeline;
|
||||||
use Friendica\Database\Database;
|
use Friendica\Database\Database;
|
||||||
|
@ -41,10 +42,10 @@ class Channel extends \Friendica\BaseRepository
|
||||||
*
|
*
|
||||||
* @param int $id The id of the user defined channel
|
* @param int $id The id of the user defined channel
|
||||||
* @param int $uid The user that this channel belongs to. (Not part of the primary key)
|
* @param int $uid The user that this channel belongs to. (Not part of the primary key)
|
||||||
* @return UserDefinedChannel
|
* @return TimelineEntity
|
||||||
* @throws \Friendica\Network\HTTPException\NotFoundException
|
* @throws \Friendica\Network\HTTPException\NotFoundException
|
||||||
*/
|
*/
|
||||||
public function selectById(int $id, int $uid): UserDefinedChannel
|
public function selectById(int $id, int $uid): TimelineEntity
|
||||||
{
|
{
|
||||||
return $this->_selectOne(['id' => $id, 'uid' => $uid]);
|
return $this->_selectOne(['id' => $id, 'uid' => $uid]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ class Channel extends Timeline
|
||||||
/** @var SystemMessages */
|
/** @var SystemMessages */
|
||||||
protected $systemMessages;
|
protected $systemMessages;
|
||||||
/** @var ChannelFactory */
|
/** @var ChannelFactory */
|
||||||
protected $channel;
|
protected $channelFactory;
|
||||||
/** @var UserDefinedChannelFactory */
|
/** @var UserDefinedChannelFactory */
|
||||||
protected $userDefinedChannel;
|
protected $userDefinedChannel;
|
||||||
/** @var CommunityFactory */
|
/** @var CommunityFactory */
|
||||||
|
@ -79,7 +79,7 @@ class Channel extends Timeline
|
||||||
$this->conversation = $conversation;
|
$this->conversation = $conversation;
|
||||||
$this->page = $page;
|
$this->page = $page;
|
||||||
$this->systemMessages = $systemMessages;
|
$this->systemMessages = $systemMessages;
|
||||||
$this->channel = $channelFactory;
|
$this->channelFactory = $channelFactory;
|
||||||
$this->community = $community;
|
$this->community = $community;
|
||||||
$this->networkFactory = $network;
|
$this->networkFactory = $network;
|
||||||
$this->userDefinedChannel = $userDefinedChannel;
|
$this->userDefinedChannel = $userDefinedChannel;
|
||||||
|
@ -105,7 +105,7 @@ class Channel extends Timeline
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($request['mode']) || ($request['mode'] != 'raw')) {
|
if (empty($request['mode']) || ($request['mode'] != 'raw')) {
|
||||||
$tabs = $this->getTabArray($this->channel->getTimelines($this->session->getLocalUserId()), 'channel');
|
$tabs = $this->getTabArray($this->channelFactory->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->userDefinedChannel->getForUser($this->session->getLocalUserId()), 'channel'));
|
||||||
$tabs = array_merge($tabs, $this->getTabArray($this->community->getTimelines(true), 'channel'));
|
$tabs = array_merge($tabs, $this->getTabArray($this->community->getTimelines(true), 'channel'));
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ class Channel extends Timeline
|
||||||
$o .= $this->conversation->statusEditor([], 0, true);
|
$o .= $this->conversation->statusEditor([], 0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->channel->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
|
if ($this->channelFactory->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
|
||||||
$items = $this->getChannelItems();
|
$items = $this->getChannelItems();
|
||||||
$order = 'created';
|
$order = 'created';
|
||||||
} else {
|
} else {
|
||||||
|
@ -174,7 +174,7 @@ class Channel extends Timeline
|
||||||
$this->selectedTab = ChannelEntity::FORYOU;
|
$this->selectedTab = ChannelEntity::FORYOU;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->channel->isTimeline($this->selectedTab) && !$this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId()) && !$this->community->isTimeline($this->selectedTab)) {
|
if (!$this->channelFactory->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.'));
|
throw new HTTPException\BadRequestException($this->l10n->t('Channel not available.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ class Network extends Timeline
|
||||||
/** @var TimelineFactory */
|
/** @var TimelineFactory */
|
||||||
protected $timeline;
|
protected $timeline;
|
||||||
/** @var ChannelFactory */
|
/** @var ChannelFactory */
|
||||||
protected $channel;
|
protected $channelFactory;
|
||||||
/** @var UserDefinedChannelFactory */
|
/** @var UserDefinedChannelFactory */
|
||||||
protected $userDefinedChannel;
|
protected $userDefinedChannel;
|
||||||
/** @var CommunityFactory */
|
/** @var CommunityFactory */
|
||||||
|
@ -118,7 +118,7 @@ class Network extends Timeline
|
||||||
$this->systemMessages = $systemMessages;
|
$this->systemMessages = $systemMessages;
|
||||||
$this->conversation = $conversation;
|
$this->conversation = $conversation;
|
||||||
$this->page = $page;
|
$this->page = $page;
|
||||||
$this->channel = $channelFactory;
|
$this->channelFactory = $channelFactory;
|
||||||
$this->community = $community;
|
$this->community = $community;
|
||||||
$this->networkFactory = $network;
|
$this->networkFactory = $network;
|
||||||
$this->userDefinedChannel = $userDefinedChannel;
|
$this->userDefinedChannel = $userDefinedChannel;
|
||||||
|
@ -139,7 +139,7 @@ class Network extends Timeline
|
||||||
|
|
||||||
$o = '';
|
$o = '';
|
||||||
|
|
||||||
if ($this->channel->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
|
if ($this->channelFactory->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
|
||||||
$items = $this->getChannelItems();
|
$items = $this->getChannelItems();
|
||||||
} elseif ($this->community->isTimeline($this->selectedTab)) {
|
} elseif ($this->community->isTimeline($this->selectedTab)) {
|
||||||
$items = $this->getCommunityItems();
|
$items = $this->getCommunityItems();
|
||||||
|
@ -286,7 +286,7 @@ class Network extends Timeline
|
||||||
|
|
||||||
$network_timelines = $this->pConfig->get($this->session->getLocalUserId(), 'system', 'network_timelines', []);
|
$network_timelines = $this->pConfig->get($this->session->getLocalUserId(), 'system', 'network_timelines', []);
|
||||||
if (!empty($network_timelines)) {
|
if (!empty($network_timelines)) {
|
||||||
$tabs = array_merge($tabs, $this->getTabArray($this->channel->getTimelines($this->session->getLocalUserId()), 'network', 'channel'));
|
$tabs = array_merge($tabs, $this->getTabArray($this->channelFactory->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->userDefinedChannel->getForUser($this->session->getLocalUserId()), 'network', 'channel'));
|
||||||
$tabs = array_merge($tabs, $this->getTabArray($this->community->getTimelines(true), '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) {
|
if (!$this->selectedTab) {
|
||||||
$this->selectedTab = self::getTimelineOrderBySession($this->session, $this->pConfig);
|
$this->selectedTab = self::getTimelineOrderBySession($this->session, $this->pConfig);
|
||||||
} elseif (!$this->networkFactory->isTimeline($this->selectedTab) && !$this->channel->isTimeline($this->selectedTab) && !$this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId()) && !$this->community->isTimeline($this->selectedTab)) {
|
} elseif (!$this->networkFactory->isTimeline($this->selectedTab) && !$this->channelFactory->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.'));
|
throw new HTTPException\BadRequestException($this->l10n->t('Network feed not available.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
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))) {
|
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))) {
|
||||||
$this->selectedTab = NetworkEntity::RECEIVED;
|
$this->selectedTab = NetworkEntity::RECEIVED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,7 +350,7 @@ class Network extends Timeline
|
||||||
$this->mention = false;
|
$this->mention = false;
|
||||||
} elseif (in_array($this->selectedTab, [NetworkEntity::RECEIVED, NetworkEntity::STAR]) || $this->community->isTimeline($this->selectedTab)) {
|
} elseif (in_array($this->selectedTab, [NetworkEntity::RECEIVED, NetworkEntity::STAR]) || $this->community->isTimeline($this->selectedTab)) {
|
||||||
$this->order = 'received';
|
$this->order = 'received';
|
||||||
} elseif (($this->selectedTab == NetworkEntity::CREATED) || $this->channel->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
|
} elseif (($this->selectedTab == NetworkEntity::CREATED) || $this->channelFactory->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
|
||||||
$this->order = 'created';
|
$this->order = 'created';
|
||||||
} else {
|
} else {
|
||||||
$this->order = 'commented';
|
$this->order = 'commented';
|
||||||
|
|
|
@ -26,7 +26,6 @@ use Friendica\App\Mode;
|
||||||
use Friendica\BaseModule;
|
use Friendica\BaseModule;
|
||||||
use Friendica\Content\Conversation\Collection\Timelines;
|
use Friendica\Content\Conversation\Collection\Timelines;
|
||||||
use Friendica\Content\Conversation\Entity\Channel as ChannelEntity;
|
use Friendica\Content\Conversation\Entity\Channel as ChannelEntity;
|
||||||
use Friendica\Content\Conversation\Entity\UserDefinedChannel as UserDefinedChannelEntity;
|
|
||||||
use Friendica\Content\Conversation\Repository\Channel;
|
use Friendica\Content\Conversation\Repository\Channel;
|
||||||
use Friendica\Core\Cache\Capability\ICanCache;
|
use Friendica\Core\Cache\Capability\ICanCache;
|
||||||
use Friendica\Core\Cache\Enum\Duration;
|
use Friendica\Core\Cache\Enum\Duration;
|
||||||
|
|
|
@ -38,7 +38,7 @@ class Channel extends ChannelModule
|
||||||
|
|
||||||
$o = '';
|
$o = '';
|
||||||
if ($this->update || $this->force) {
|
if ($this->update || $this->force) {
|
||||||
if ($this->channel->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
|
if ($this->channelFactory->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
|
||||||
$items = $this->getChannelItems();
|
$items = $this->getChannelItems();
|
||||||
} else {
|
} else {
|
||||||
$items = $this->getCommunityItems();
|
$items = $this->getCommunityItems();
|
||||||
|
|
|
@ -41,7 +41,7 @@ class Network extends NetworkModule
|
||||||
System::htmlUpdateExit($o);
|
System::htmlUpdateExit($o);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->channel->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
|
if ($this->channelFactory->isTimeline($this->selectedTab) || $this->userDefinedChannel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
|
||||||
$items = $this->getChannelItems();
|
$items = $this->getChannelItems();
|
||||||
} elseif ($this->community->isTimeline($this->selectedTab)) {
|
} elseif ($this->community->isTimeline($this->selectedTab)) {
|
||||||
$items = $this->getCommunityItems();
|
$items = $this->getCommunityItems();
|
||||||
|
|
Loading…
Reference in a new issue