From b0025745909b527127c7dd09fea0f9920158b595 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 3 Jan 2018 14:49:22 +0000 Subject: [PATCH] Make the community pages available to local users every time --- mod/admin.php | 2 +- mod/community.php | 2 +- src/Module/Global.php | 32 ++------------------------------ 3 files changed, 4 insertions(+), 32 deletions(-) diff --git a/mod/admin.php b/mod/admin.php index bef912cd50..f9cd9c25b1 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -1312,7 +1312,7 @@ function admin_page_site(App $a) '$no_multi_reg' => array('no_multi_reg', t("Block multiple registrations"), Config::get('system','block_extended_register'), t("Disallow users to register additional accounts for use as pages.")), '$no_openid' => array('no_openid', t("OpenID support"), !Config::get('system','no_openid'), t("OpenID support for registration and logins.")), '$no_regfullname' => array('no_regfullname', t("Fullname check"), !Config::get('system','no_regfullname'), t("Force users to register with a space between firstname and lastname in Full name, as an antispam measure")), - '$community_page_style' => array('community_page_style', t("Community Page Style"), Config::get('system','community_page_style'), t("Type of community page to show. 'Global community' shows every public posting from an open distributed network that arrived on this server."), $community_page_style_choices), + '$community_page_style' => array('community_page_style', t("Community pages for visitors"), Config::get('system','community_page_style'), t("Which community pages should be shown to visitors. Local users always see both pages. 'Global community' shows every public posting from an open distributed network that arrived on this server."), $community_page_style_choices), '$max_author_posts_community_page' => array('max_author_posts_community_page', t("Posts per user on community page"), Config::get('system','max_author_posts_community_page'), t("The maximum number of posts per user on the community page. (Not valid for 'Global Community')")), '$ostatus_disabled' => array('ostatus_disabled', t("Enable OStatus support"), !Config::get('system','ostatus_disabled'), t("Provide built-in OStatus \x28StatusNet, GNU Social etc.\x29 compatibility. All communications in OStatus are public, so privacy warnings will be occasionally displayed.")), '$ostatus_full_threads' => array('ostatus_full_threads', t("Only import OStatus threads from our contacts"), Config::get('system','ostatus_full_threads'), t("Normally we import every content from our OStatus contacts. With this option we only store threads that are started by a contact that is known on our system.")), diff --git a/mod/community.php b/mod/community.php index 1a110a3b05..f4c650ec17 100644 --- a/mod/community.php +++ b/mod/community.php @@ -19,7 +19,7 @@ function community_content(App $a, $update = 0) { return; } - if (!in_array(Config::get('system','community_page_style'), [CP_USERS_ON_SERVER, CP_USERS_AND_GLOBAL])) { + if (!local_user() && !in_array(Config::get('system','community_page_style'), [CP_USERS_ON_SERVER, CP_USERS_AND_GLOBAL])) { notice(t('Not available.') . EOL); return; } diff --git a/src/Module/Global.php b/src/Module/Global.php index 310ecd0221..a48ea4dc18 100644 --- a/src/Module/Global.php +++ b/src/Module/Global.php @@ -36,7 +36,7 @@ class GlobalModule extends BaseModule { return; } - if (!in_array(Config::get('system','community_page_style'), [CP_GLOBAL_COMMUNITY, CP_USERS_AND_GLOBAL])) { + if (!local_user() && !in_array(Config::get('system','community_page_style'), [CP_GLOBAL_COMMUNITY, CP_USERS_AND_GLOBAL])) { notice(t('Not available.') . EOL); return; } @@ -66,37 +66,9 @@ class GlobalModule extends BaseModule { return $o; } - $maxpostperauthor = Config::get('system','max_author_posts_community_page'); - - if ($maxpostperauthor != 0) { - $count = 1; - $previousauthor = ""; - $numposts = 0; - $s = array(); - - do { - foreach ($r AS $row=>$item) { - if ($previousauthor == $item["author-link"]) { - ++$numposts; - } else { - $numposts = 0; - } - $previousauthor = $item["author-link"]; - - if (($numposts < $maxpostperauthor) && (sizeof($s) < $a->pager['itemspage'])) { - $s[] = $item; - } - } - if (sizeof($s) < $a->pager['itemspage']) { - $r = self::getPublicItems($a->pager['start'] + ($count * $a->pager['itemspage']), $a->pager['itemspage']); - } - } while ((sizeof($s) < $a->pager['itemspage']) && (++$count < 50) && (sizeof($r) > 0)); - } else { - $s = $r; - } // we behave the same in message lists as the search module - $o .= conversation($a, $s, 'community', $update); + $o .= conversation($a, $r, 'community', $update); $o .= alt_pager($a, count($r));