]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Conversation/Community.php
Merge pull request #8293 from MrPetovan/task/5562-community-pagination
[friendica.git] / src / Module / Conversation / Community.php
index ccd9554b8aa4a9051f9bcea2979bc5bccb210ee3..58af38eb16d72f11d5cb715a0ea919bc92571f39 100644 (file)
@@ -51,7 +51,7 @@ class Community extends BaseModule
 
                $tabs = [];
 
-               if ((local_user() || in_array(self::$page_style, [CP_USERS_AND_GLOBAL, CP_USERS_ON_SERVER])) && empty(DI::config()->get('system', 'singleuser'))) {
+               if ((Session::isAuthenticated() || in_array(self::$page_style, [CP_USERS_AND_GLOBAL, CP_USERS_ON_SERVER])) && empty(DI::config()->get('system', 'singleuser'))) {
                        $tabs[] = [
                                'label' => DI::l10n()->t('Local Community'),
                                'url' => 'community/local',
@@ -62,7 +62,7 @@ class Community extends BaseModule
                        ];
                }
 
-               if (local_user() || in_array(self::$page_style, [CP_USERS_AND_GLOBAL, CP_GLOBAL_COMMUNITY])) {
+               if (Session::isAuthenticated() || in_array(self::$page_style, [CP_USERS_AND_GLOBAL, CP_GLOBAL_COMMUNITY])) {
                        $tabs[] = [
                                'label' => DI::l10n()->t('Global Community'),
                                'url' => 'community/global',
@@ -86,7 +86,7 @@ class Community extends BaseModule
                }
 
                // We need the editor here to be able to reshare an item.
-               if (local_user()) {
+               if (Session::isAuthenticated()) {
                        $x = [
                                'is_owner' => true,
                                'allow_location' => DI::app()->user['allow_location'],
@@ -179,7 +179,7 @@ class Community extends BaseModule
                }
 
                // Check if we are allowed to display the content to visitors
-               if (!local_user()) {
+               if (!Session::isAuthenticated()) {
                        $available = self::$page_style == CP_USERS_AND_GLOBAL;
 
                        if (!$available) {
@@ -195,11 +195,12 @@ class Community extends BaseModule
                        }
                }
 
-               // check if we serve a mobile device and get the user settings accordingly
                if (DI::mode()->isMobile()) {
-                       self::$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network', 20);
+                       self::$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',
+                               DI::config()->get('system', 'itemspage_network_mobile'));
                } else {
-                       self::$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_network', 40);
+                       self::$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_network',
+                               DI::config()->get('system', 'itemspage_network'));
                }
 
                // now that we have the user settings, see if the theme forces
@@ -272,6 +273,7 @@ class Community extends BaseModule
         * @param $itemspage
         * @return array
         * @throws \Exception
+        * @TODO Move to repository/factory
         */
        private static function selectItems($since_id, $max_id, $itemspage)
        {