]> git.mxchange.org Git - friendica.git/commitdiff
Add new Conversation\Network::getTimelineOrderBySession method
authorHypolite Petovan <hypolite@mrpetovan.com>
Thu, 3 Nov 2022 00:37:14 +0000 (20:37 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Fri, 4 Nov 2022 10:42:37 +0000 (06:42 -0400)
src/Module/Conversation/Network.php

index ce2afbfc7571b2b71716807c92c6d3a0a7564e02..928f2e2838e6ed36d647c2a18facd2de6791cb65 100644 (file)
@@ -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')
+                       ?? '';
+       }
 }