From da3041a4d43de46d70dd407caf1e9ff531fc55cf Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 2 Nov 2022 20:37:14 -0400 Subject: [PATCH] Add new Conversation\Network::getTimelineOrderBySession method --- src/Module/Conversation/Network.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Module/Conversation/Network.php b/src/Module/Conversation/Network.php index ce2afbfc7..928f2e283 100644 --- a/src/Module/Conversation/Network.php +++ b/src/Module/Conversation/Network.php @@ -29,7 +29,9 @@ use Friendica\Content\Widget; use Friendica\Content\Text\HTML; use Friendica\Core\ACL; use Friendica\Core\Hook; +use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues; use Friendica\Core\Renderer; +use Friendica\Core\Session\Capability\IHandleUserSessions; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Contact; @@ -306,7 +308,7 @@ class Network extends BaseModule self::$forumContactId = $this->parameters['contact_id'] ?? 0; - self::$selectedTab = DI::session()->get('network-tab', DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'network.view', 'selected_tab', '')); + self::$selectedTab = self::getTimelineOrderBySession(DI::userSession(), DI::pConfig()); if (!empty($get['star'])) { self::$selectedTab = 'star'; @@ -486,4 +488,18 @@ class Network extends BaseModule return $items; } + + /** + * Returns the selected network tab of the currently logged-in user + * + * @param IHandleUserSessions $session + * @param IManagePersonalConfigValues $pconfig + * @return string + */ + public static function getTimelineOrderBySession(IHandleUserSessions $session, IManagePersonalConfigValues $pconfig): string + { + return $session->get('network-tab') + ?? $pconfig->get($session->getLocalUserId(), 'network.view', 'selected_tab') + ?? ''; + } }