mirror of
https://github.com/friendica/friendica
synced 2025-04-24 04:30:11 +00:00
Timeline classes are split into multiple classes
This commit is contained in:
parent
5d6e02bef3
commit
6a86eeda10
19 changed files with 523 additions and 173 deletions
|
@ -25,9 +25,12 @@ use Friendica\App;
|
|||
use Friendica\App\Mode;
|
||||
use Friendica\Content\BoundariesPager;
|
||||
use Friendica\Content\Conversation;
|
||||
use Friendica\Content\Conversation\Entity\Timeline as TimelineEntity;
|
||||
use Friendica\Content\Conversation\Entity\Channel as ChannelEntity;
|
||||
use Friendica\Content\Conversation\Factory\Timeline as TimelineFactory;
|
||||
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\Feature;
|
||||
use Friendica\Content\Nav;
|
||||
use Friendica\Content\Text\HTML;
|
||||
|
@ -57,8 +60,14 @@ class Channel extends Timeline
|
|||
protected $page;
|
||||
/** @var SystemMessages */
|
||||
protected $systemMessages;
|
||||
/** @var ChannelFactory */
|
||||
protected $channel;
|
||||
/** @var CommunityFactory */
|
||||
protected $community;
|
||||
/** @var NetworkFactory */
|
||||
protected $networkFactory;
|
||||
|
||||
public function __construct(ChannelRepository $channel, TimelineFactory $timeline, Conversation $conversation, App\Page $page, SystemMessages $systemMessages, 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 = [])
|
||||
public function __construct(NetworkFactory $network, CommunityFactory $community, ChannelFactory $channelFactory, ChannelRepository $channel, TimelineFactory $timeline, Conversation $conversation, App\Page $page, SystemMessages $systemMessages, 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($channel, $mode, $session, $database, $pConfig, $config, $cache, $l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
||||
|
||||
|
@ -66,6 +75,9 @@ class Channel extends Timeline
|
|||
$this->conversation = $conversation;
|
||||
$this->page = $page;
|
||||
$this->systemMessages = $systemMessages;
|
||||
//$this->channel = $channelFactory;
|
||||
$this->community = $community;
|
||||
$this->networkFactory = $network;
|
||||
}
|
||||
|
||||
protected function content(array $request = []): string
|
||||
|
@ -88,8 +100,8 @@ class Channel extends Timeline
|
|||
}
|
||||
|
||||
if (empty($request['mode']) || ($request['mode'] != 'raw')) {
|
||||
$tabs = $this->getTabArray($this->timeline->getChannelsForUser($this->session->getLocalUserId()), 'channel');
|
||||
$tabs = array_merge($tabs, $this->getTabArray($this->timeline->getCommunities(true), 'channel'));
|
||||
$tabs = $this->getTabArray($this->channel->getForUser($this->session->getLocalUserId()), 'channel');
|
||||
$tabs = array_merge($tabs, $this->getTabArray($this->community->getTimelines(true), 'channel'));
|
||||
|
||||
$tab_tpl = Renderer::getMarkupTemplate('common_tabs.tpl');
|
||||
$o .= Renderer::replaceMacros($tab_tpl, ['$tabs' => $tabs]);
|
||||
|
@ -98,7 +110,7 @@ class Channel extends Timeline
|
|||
|
||||
$this->page['aside'] .= Widget::accountTypes('channel/' . $this->selectedTab, $this->accountTypeString);
|
||||
|
||||
if (!in_array($this->selectedTab, [TimelineEntity::FOLLOWERS, TimelineEntity::FORYOU]) && $this->config->get('system', 'community_no_sharer')) {
|
||||
if (!in_array($this->selectedTab, [ChannelEntity::FOLLOWERS, ChannelEntity::FORYOU]) && $this->config->get('system', 'community_no_sharer')) {
|
||||
$this->page['aside'] .= $this->getNoSharerWidget('channel');
|
||||
}
|
||||
|
||||
|
@ -110,7 +122,7 @@ class Channel extends Timeline
|
|||
$o .= $this->conversation->statusEditor([], 0, true);
|
||||
}
|
||||
|
||||
if ($this->timeline->isChannel($this->selectedTab, $this->session->getLocalUserId())) {
|
||||
if ($this->channel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
|
||||
$items = $this->getChannelItems();
|
||||
$order = 'created';
|
||||
} else {
|
||||
|
@ -153,10 +165,10 @@ class Channel extends Timeline
|
|||
parent::parseRequest($request);
|
||||
|
||||
if (!$this->selectedTab) {
|
||||
$this->selectedTab = TimelineEntity::FORYOU;
|
||||
$this->selectedTab = ChannelEntity::FORYOU;
|
||||
}
|
||||
|
||||
if (!$this->timeline->isChannel($this->selectedTab, $this->session->getLocalUserId()) && !$this->timeline->isCommunity($this->selectedTab)) {
|
||||
if (!$this->channel->isTimeline($this->selectedTab, $this->session->getLocalUserId()) && !$this->community->isTimeline($this->selectedTab)) {
|
||||
throw new HTTPException\BadRequestException($this->l10n->t('Channel not available.'));
|
||||
}
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@ use Friendica\App;
|
|||
use Friendica\App\Mode;
|
||||
use Friendica\Content\BoundariesPager;
|
||||
use Friendica\Content\Conversation;
|
||||
use Friendica\Content\Conversation\Entity\Timeline as TimelineEntity;
|
||||
use Friendica\Content\Conversation\Factory\Timeline as TimelineFactory;
|
||||
use Friendica\Content\Conversation\Entity\Community as CommunityEntity;
|
||||
use Friendica\Content\Conversation\Factory\Community as CommunityFactory;
|
||||
use Friendica\Content\Conversation\Repository\Channel;
|
||||
use Friendica\Content\Feature;
|
||||
use Friendica\Content\Nav;
|
||||
|
@ -61,8 +61,8 @@ class Community extends Timeline
|
|||
|
||||
protected $pageStyle;
|
||||
|
||||
/** @var TimelineFactory */
|
||||
protected $timeline;
|
||||
/** @var CommunityFactory */
|
||||
protected $community;
|
||||
/** @var Conversation */
|
||||
protected $conversation;
|
||||
/** @var App\Page */
|
||||
|
@ -70,11 +70,11 @@ class Community extends Timeline
|
|||
/** @var SystemMessages */
|
||||
protected $systemMessages;
|
||||
|
||||
public function __construct(Channel $channel, TimelineFactory $timeline, Conversation $conversation, App\Page $page, SystemMessages $systemMessages, 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 = [])
|
||||
public function __construct(Channel $channel, CommunityFactory $community, Conversation $conversation, App\Page $page, SystemMessages $systemMessages, 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($channel, $mode, $session, $database, $pConfig, $config, $cache, $l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
||||
|
||||
$this->timeline = $timeline;
|
||||
$this->community = $community;
|
||||
$this->conversation = $conversation;
|
||||
$this->page = $page;
|
||||
$this->systemMessages = $systemMessages;
|
||||
|
@ -88,7 +88,7 @@ class Community extends Timeline
|
|||
$o = Renderer::replaceMacros($t, [
|
||||
'$content' => '',
|
||||
'$header' => '',
|
||||
'$show_global_community_hint' => ($this->selectedTab == TimelineEntity::GLOBAL) && $this->config->get('system', 'show_global_community_hint'),
|
||||
'$show_global_community_hint' => ($this->selectedTab == CommunityEntity::GLOBAL) && $this->config->get('system', 'show_global_community_hint'),
|
||||
'$global_community_hint' => $this->l10n->t("This community stream shows all public posts received by this node. They may not reflect the opinions of this node’s users.")
|
||||
]);
|
||||
|
||||
|
@ -98,7 +98,7 @@ class Community extends Timeline
|
|||
}
|
||||
|
||||
if (empty($request['mode']) || ($request['mode'] != 'raw')) {
|
||||
$tabs = $this->getTabArray($this->timeline->getCommunities($this->session->isAuthenticated()), 'community');
|
||||
$tabs = $this->getTabArray($this->community->getTimelines($this->session->isAuthenticated()), 'community');
|
||||
$tab_tpl = Renderer::getMarkupTemplate('common_tabs.tpl');
|
||||
$o .= Renderer::replaceMacros($tab_tpl, ['$tabs' => $tabs]);
|
||||
|
||||
|
@ -169,14 +169,14 @@ class Community extends Timeline
|
|||
if (!$this->selectedTab) {
|
||||
if (!empty($this->config->get('system', 'singleuser'))) {
|
||||
// On single user systems only the global page does make sense
|
||||
$this->selectedTab = TimelineEntity::GLOBAL;
|
||||
$this->selectedTab = CommunityEntity::GLOBAL;
|
||||
} else {
|
||||
// When only the global community is allowed, we use this as default
|
||||
$this->selectedTab = $this->pageStyle == self::GLOBAL ? TimelineEntity::GLOBAL : TimelineEntity::LOCAL;
|
||||
$this->selectedTab = $this->pageStyle == self::GLOBAL ? CommunityEntity::GLOBAL : CommunityEntity::LOCAL;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->timeline->isCommunity($this->selectedTab)) {
|
||||
if (!$this->community->isTimeline($this->selectedTab)) {
|
||||
throw new HTTPException\BadRequestException($this->l10n->t('Community option not available.'));
|
||||
}
|
||||
|
||||
|
@ -185,11 +185,11 @@ class Community extends Timeline
|
|||
$available = $this->pageStyle == self::LOCAL_AND_GLOBAL;
|
||||
|
||||
if (!$available) {
|
||||
$available = ($this->pageStyle == self::LOCAL) && ($this->selectedTab == TimelineEntity::LOCAL);
|
||||
$available = ($this->pageStyle == self::LOCAL) && ($this->selectedTab == CommunityEntity::LOCAL);
|
||||
}
|
||||
|
||||
if (!$available) {
|
||||
$available = ($this->pageStyle == self::GLOBAL) && ($this->selectedTab == TimelineEntity::GLOBAL);
|
||||
$available = ($this->pageStyle == self::GLOBAL) && ($this->selectedTab == CommunityEntity::GLOBAL);
|
||||
}
|
||||
|
||||
if (!$available) {
|
||||
|
|
|
@ -25,9 +25,12 @@ use Friendica\App;
|
|||
use Friendica\App\Mode;
|
||||
use Friendica\Content\BoundariesPager;
|
||||
use Friendica\Content\Conversation;
|
||||
use Friendica\Content\Conversation\Entity\Timeline as TimelineEntity;
|
||||
use Friendica\Content\Conversation\Entity\Network as NetworkEntity;
|
||||
use Friendica\Content\Conversation\Factory\Timeline as TimelineFactory;
|
||||
use Friendica\Content\Conversation\Repository\Channel;
|
||||
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\Feature;
|
||||
use Friendica\Content\GroupManager;
|
||||
use Friendica\Content\Nav;
|
||||
|
@ -96,8 +99,14 @@ class Network extends Timeline
|
|||
protected $database;
|
||||
/** @var TimelineFactory */
|
||||
protected $timeline;
|
||||
/** @var ChannelFactory */
|
||||
protected $channel;
|
||||
/** @var CommunityFactory */
|
||||
protected $community;
|
||||
/** @var NetworkFactory */
|
||||
protected $networkFactory;
|
||||
|
||||
public function __construct(Channel $channel, App $app, TimelineFactory $timeline, SystemMessages $systemMessages, Mode $mode, Conversation $conversation, App\Page $page, 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 = [])
|
||||
public function __construct(NetworkFactory $network, CommunityFactory $community, ChannelFactory $channelFactory, Channel $channel, App $app, TimelineFactory $timeline, SystemMessages $systemMessages, Mode $mode, Conversation $conversation, App\Page $page, 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($channel, $mode, $session, $database, $pConfig, $config, $cache, $l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
||||
|
||||
|
@ -106,6 +115,9 @@ class Network extends Timeline
|
|||
$this->systemMessages = $systemMessages;
|
||||
$this->conversation = $conversation;
|
||||
$this->page = $page;
|
||||
$this->channel = $channelFactory;
|
||||
$this->community = $community;
|
||||
$this->networkFactory = $network;
|
||||
}
|
||||
|
||||
protected function content(array $request = []): string
|
||||
|
@ -123,9 +135,9 @@ class Network extends Timeline
|
|||
|
||||
$o = '';
|
||||
|
||||
if ($this->timeline->isChannel($this->selectedTab, $this->session->getLocalUserId())) {
|
||||
if ($this->channel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
|
||||
$items = $this->getChannelItems();
|
||||
} elseif ($this->timeline->isCommunity($this->selectedTab)) {
|
||||
} elseif ($this->community->isTimeline($this->selectedTab)) {
|
||||
$items = $this->getCommunityItems();
|
||||
} else {
|
||||
$items = $this->getItems();
|
||||
|
@ -266,12 +278,12 @@ class Network extends Timeline
|
|||
*/
|
||||
private function getTabsHTML()
|
||||
{
|
||||
$tabs = $this->getTabArray($this->timeline->getNetworkFeeds($this->args->getCommand()), 'network');
|
||||
$tabs = $this->getTabArray($this->networkFactory->getTimelines($this->args->getCommand()), 'network');
|
||||
|
||||
$network_timelines = $this->pConfig->get($this->session->getLocalUserId(), 'system', 'network_timelines', []);
|
||||
if (!empty($network_timelines)) {
|
||||
$tabs = array_merge($tabs, $this->getTabArray($this->timeline->getChannelsForUser($this->session->getLocalUserId()), 'network', 'channel'));
|
||||
$tabs = array_merge($tabs, $this->getTabArray($this->timeline->getCommunities(true), 'network', 'channel'));
|
||||
$tabs = array_merge($tabs, $this->getTabArray($this->channel->getForUser($this->session->getLocalUserId()), 'network', 'channel'));
|
||||
$tabs = array_merge($tabs, $this->getTabArray($this->community->getTimelines(true), 'network', 'channel'));
|
||||
}
|
||||
|
||||
$arr = ['tabs' => $tabs];
|
||||
|
@ -304,26 +316,26 @@ class Network extends Timeline
|
|||
|
||||
if (!$this->selectedTab) {
|
||||
$this->selectedTab = self::getTimelineOrderBySession($this->session, $this->pConfig);
|
||||
} elseif (!$this->timeline->isNetwork($this->selectedTab) && !$this->timeline->isChannel($this->selectedTab, $this->session->getLocalUserId()) && !$this->timeline->isCommunity($this->selectedTab)) {
|
||||
} elseif (!$this->networkFactory->isTimeline($this->selectedTab) && !$this->channel->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->timeline->isChannel($this->selectedTab, $this->session->getLocalUserId()) || $this->timeline->isCommunity($this->selectedTab))) {
|
||||
$this->selectedTab = TimelineEntity::RECEIVED;
|
||||
if (($this->network || $this->circleId || $this->groupContactId) && ($this->channel->isTimeline($this->selectedTab, $this->session->getLocalUserId()) || $this->community->isTimeline($this->selectedTab))) {
|
||||
$this->selectedTab = NetworkEntity::RECEIVED;
|
||||
}
|
||||
|
||||
if (!empty($request['star'])) {
|
||||
$this->selectedTab = TimelineEntity::STAR;
|
||||
$this->selectedTab = NetworkEntity::STAR;
|
||||
$this->star = true;
|
||||
} else {
|
||||
$this->star = $this->selectedTab == TimelineEntity::STAR;
|
||||
$this->star = $this->selectedTab == NetworkEntity::STAR;
|
||||
}
|
||||
|
||||
if (!empty($request['mention'])) {
|
||||
$this->selectedTab = TimelineEntity::MENTION;
|
||||
$this->selectedTab = NetworkEntity::MENTION;
|
||||
$this->mention = true;
|
||||
} else {
|
||||
$this->mention = $this->selectedTab == TimelineEntity::MENTION;
|
||||
$this->mention = $this->selectedTab == NetworkEntity::MENTION;
|
||||
}
|
||||
|
||||
if (!empty($request['order'])) {
|
||||
|
@ -331,9 +343,9 @@ class Network extends Timeline
|
|||
$this->order = $request['order'];
|
||||
$this->star = false;
|
||||
$this->mention = false;
|
||||
} elseif (in_array($this->selectedTab, [TimelineEntity::RECEIVED, TimelineEntity::STAR]) || $this->timeline->isCommunity($this->selectedTab)) {
|
||||
} elseif (in_array($this->selectedTab, [NetworkEntity::RECEIVED, NetworkEntity::STAR]) || $this->community->isTimeline($this->selectedTab)) {
|
||||
$this->order = 'received';
|
||||
} elseif (($this->selectedTab == TimelineEntity::CREATED) || $this->timeline->isChannel($this->selectedTab, $this->session->getLocalUserId())) {
|
||||
} elseif (($this->selectedTab == NetworkEntity::CREATED) || $this->channel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
|
||||
$this->order = 'created';
|
||||
} else {
|
||||
$this->order = 'commented';
|
||||
|
@ -343,16 +355,16 @@ class Network extends Timeline
|
|||
|
||||
// Upon updates in the background and order by last comment we order by received date,
|
||||
// since otherwise the feed will optically jump, when some already visible thread has been updated.
|
||||
if ($this->update && ($this->selectedTab == TimelineEntity::COMMENTED)) {
|
||||
if ($this->update && ($this->selectedTab == NetworkEntity::COMMENTED)) {
|
||||
$this->order = 'received';
|
||||
$request['last_received'] = $request['last_commented'] ?? null;
|
||||
$request['first_received'] = $request['first_commented'] ?? null;
|
||||
}
|
||||
|
||||
// Prohibit combined usage of "star" and "mention"
|
||||
if ($this->selectedTab == TimelineEntity::STAR) {
|
||||
if ($this->selectedTab == NetworkEntity::STAR) {
|
||||
$this->mention = false;
|
||||
} elseif ($this->selectedTab == TimelineEntity::MENTION) {
|
||||
} elseif ($this->selectedTab == NetworkEntity::MENTION) {
|
||||
$this->star = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ use Friendica\App;
|
|||
use Friendica\App\Mode;
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Content\Conversation\Collection\Timelines;
|
||||
use Friendica\Content\Conversation\Entity\Timeline as TimelineEntity;
|
||||
use Friendica\Content\Conversation\Entity\Channel as ChannelEntity;
|
||||
use Friendica\Content\Conversation\Repository\Channel;
|
||||
use Friendica\Core\Cache\Capability\ICanCache;
|
||||
use Friendica\Core\Cache\Enum\Duration;
|
||||
|
@ -269,13 +269,13 @@ class Timeline extends BaseModule
|
|||
{
|
||||
$uid = $this->session->getLocalUserId();
|
||||
|
||||
if ($this->selectedTab == TimelineEntity::WHATSHOT) {
|
||||
if ($this->selectedTab == ChannelEntity::WHATSHOT) {
|
||||
if (!is_null($this->accountType)) {
|
||||
$condition = ["(`comments` > ? OR `activities` > ?) AND `contact-type` = ?", $this->getMedianComments($uid, 4), $this->getMedianActivities($uid, 4), $this->accountType];
|
||||
} else {
|
||||
$condition = ["(`comments` > ? OR `activities` > ?) AND `contact-type` != ?", $this->getMedianComments($uid, 4), $this->getMedianActivities($uid, 4), Contact::TYPE_COMMUNITY];
|
||||
}
|
||||
} elseif ($this->selectedTab == TimelineEntity::FORYOU) {
|
||||
} elseif ($this->selectedTab == ChannelEntity::FORYOU) {
|
||||
$cid = Contact::getPublicIdByUserId($uid);
|
||||
|
||||
$condition = [
|
||||
|
@ -285,9 +285,9 @@ class Timeline extends BaseModule
|
|||
$cid, $this->getMedianRelationThreadScore($cid, 4), $this->getMedianComments($uid, 4), $this->getMedianActivities($uid, 4), $cid,
|
||||
$uid, Contact\User::FREQUENCY_ALWAYS
|
||||
];
|
||||
} elseif ($this->selectedTab == TimelineEntity::FOLLOWERS) {
|
||||
} elseif ($this->selectedTab == ChannelEntity::FOLLOWERS) {
|
||||
$condition = ["`owner-id` IN (SELECT `pid` FROM `account-user-view` WHERE `uid` = ? AND `rel` = ?)", $uid, Contact::FOLLOWER];
|
||||
} elseif ($this->selectedTab == TimelineEntity::SHARERSOFSHARERS) {
|
||||
} elseif ($this->selectedTab == ChannelEntity::SHARERSOFSHARERS) {
|
||||
$cid = Contact::getPublicIdByUserId($uid);
|
||||
|
||||
// @todo Suggest posts from contacts that are followed most by our followers
|
||||
|
@ -297,19 +297,19 @@ class Timeline extends BaseModule
|
|||
AND NOT `cid` IN (SELECT `cid` FROM `contact-relation` WHERE `follows` AND `relation-cid` = ?))",
|
||||
DateTimeFormat::utc('now - ' . $this->config->get('channel', 'sharer_interaction_days') . ' day'), $cid, $this->getMedianRelationThreadScore($cid, 4), $cid
|
||||
];
|
||||
} elseif ($this->selectedTab == TimelineEntity::IMAGE) {
|
||||
} elseif ($this->selectedTab == ChannelEntity::IMAGE) {
|
||||
$condition = ["`media-type` & ?", 1];
|
||||
} elseif ($this->selectedTab == TimelineEntity::VIDEO) {
|
||||
} elseif ($this->selectedTab == ChannelEntity::VIDEO) {
|
||||
$condition = ["`media-type` & ?", 2];
|
||||
} elseif ($this->selectedTab == TimelineEntity::AUDIO) {
|
||||
} elseif ($this->selectedTab == ChannelEntity::AUDIO) {
|
||||
$condition = ["`media-type` & ?", 4];
|
||||
} elseif ($this->selectedTab == TimelineEntity::LANGUAGE) {
|
||||
} elseif ($this->selectedTab == ChannelEntity::LANGUAGE) {
|
||||
$condition = ["JSON_EXTRACT(JSON_KEYS(language), '$[0]') = ?", $this->l10n->convertCodeForLanguageDetection(User::getLanguageCode($uid))];
|
||||
} elseif (is_numeric($this->selectedTab)) {
|
||||
$condition = $this->getUserChannelConditions($this->selectedTab, $this->session->getLocalUserId());
|
||||
}
|
||||
|
||||
if ($this->selectedTab != TimelineEntity::LANGUAGE) {
|
||||
if ($this->selectedTab != ChannelEntity::LANGUAGE) {
|
||||
$condition = $this->addLanguageCondition($uid, $condition);
|
||||
}
|
||||
|
||||
|
@ -317,7 +317,7 @@ class Timeline extends BaseModule
|
|||
|
||||
$condition = DBA::mergeConditions($condition, ["NOT EXISTS(SELECT `cid` FROM `user-contact` WHERE `uid` = ? AND `cid` = `post-engagement`.`owner-id` AND (`ignored` OR `blocked` OR `collapsed` OR `is-blocked` OR `channel-frequency` = ?))", $uid, Contact\User::FREQUENCY_NEVER]);
|
||||
|
||||
if (($this->selectedTab != TimelineEntity::WHATSHOT) && !is_null($this->accountType)) {
|
||||
if (($this->selectedTab != ChannelEntity::WHATSHOT) && !is_null($this->accountType)) {
|
||||
$condition = DBA::mergeConditions($condition, ['contact-type' => $this->accountType]);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,9 @@ namespace Friendica\Module\Settings;
|
|||
use Friendica\App;
|
||||
use Friendica\Content\Conversation\Collection\Timelines;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
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\Timeline as TimelineFactory;
|
||||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||
use Friendica\Core\Hook;
|
||||
|
@ -53,10 +56,16 @@ class Display extends BaseSettings
|
|||
private $app;
|
||||
/** @var SystemMessages */
|
||||
private $systemMessages;
|
||||
/** @var ChannelFactory */
|
||||
protected $channel;
|
||||
/** @var CommunityFactory */
|
||||
protected $community;
|
||||
/** @var NetworkFactory */
|
||||
protected $network;
|
||||
/** @var TimelineFactory */
|
||||
protected $timeline;
|
||||
|
||||
public function __construct(TimelineFactory $timeline, SystemMessages $systemMessages, App $app, IManagePersonalConfigValues $pConfig, IManageConfigValues $config, IHandleUserSessions $session, App\Page $page, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
|
||||
public function __construct(NetworkFactory $network, CommunityFactory $community, ChannelFactory $channel, TimelineFactory $timeline, SystemMessages $systemMessages, App $app, IManagePersonalConfigValues $pConfig, IManageConfigValues $config, IHandleUserSessions $session, App\Page $page, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
|
||||
{
|
||||
parent::__construct($session, $page, $l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
||||
|
||||
|
@ -65,6 +74,9 @@ class Display extends BaseSettings
|
|||
$this->app = $app;
|
||||
$this->systemMessages = $systemMessages;
|
||||
$this->timeline = $timeline;
|
||||
$this->channel = $channel;
|
||||
$this->community = $community;
|
||||
$this->network = $network;
|
||||
}
|
||||
|
||||
protected function post(array $request = [])
|
||||
|
@ -329,7 +341,7 @@ class Display extends BaseSettings
|
|||
{
|
||||
$timelines = [];
|
||||
|
||||
foreach ($this->timeline->getNetworkFeeds('') as $channel) {
|
||||
foreach ($this->network->getTimelines('') as $channel) {
|
||||
$timelines[] = $channel;
|
||||
}
|
||||
|
||||
|
@ -337,11 +349,11 @@ class Display extends BaseSettings
|
|||
return new Timelines($timelines);
|
||||
}
|
||||
|
||||
foreach ($this->timeline->getChannelsForUser($uid) as $channel) {
|
||||
foreach ($this->channel->getForUser($uid) as $channel) {
|
||||
$timelines[] = $channel;
|
||||
}
|
||||
|
||||
foreach ($this->timeline->getCommunities(true) as $community) {
|
||||
foreach ($this->community->getTimelines(true) as $community) {
|
||||
$timelines[] = $community;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class Channel extends ChannelModule
|
|||
|
||||
$o = '';
|
||||
if ($this->update || $this->force) {
|
||||
if ($this->timeline->isChannel($this->selectedTab, $this->session->getLocalUserId())) {
|
||||
if ($this->channel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
|
||||
$items = $this->getChannelItems();
|
||||
} else {
|
||||
$items = $this->getCommunityItems();
|
||||
|
|
|
@ -41,9 +41,9 @@ class Network extends NetworkModule
|
|||
System::htmlUpdateExit($o);
|
||||
}
|
||||
|
||||
if ($this->timeline->isChannel($this->selectedTab, $this->session->getLocalUserId())) {
|
||||
if ($this->channel->isTimeline($this->selectedTab, $this->session->getLocalUserId())) {
|
||||
$items = $this->getChannelItems();
|
||||
} elseif ($this->timeline->isCommunity($this->selectedTab)) {
|
||||
} elseif ($this->community->isTimeline($this->selectedTab)) {
|
||||
$items = $this->getCommunityItems();
|
||||
} else {
|
||||
$items = $this->getItems();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue