1
1
Fork 0

Public federated items now always are having an entry with "uid=0"

This commit is contained in:
Michael 2018-04-23 11:14:25 +00:00
parent a25c07b162
commit ba35b19af6
5 changed files with 15 additions and 25 deletions

View file

@ -232,10 +232,11 @@ define('ACCOUNT_TYPE_RELAY', 4);
* Type of the community page
* @{
*/
define('CP_NO_COMMUNITY_PAGE', -1);
define('CP_USERS_ON_SERVER', 0);
define('CP_GLOBAL_COMMUNITY', 1);
define('CP_USERS_AND_GLOBAL', 2);
define('CP_NO_INTERNAL_COMMUNITY', -2);
define('CP_NO_COMMUNITY_PAGE', -1);
define('CP_USERS_ON_SERVER', 0);
define('CP_GLOBAL_COMMUNITY', 1);
define('CP_USERS_AND_GLOBAL', 2);
/**
* @}
*/

View file

@ -1262,6 +1262,7 @@ function admin_page_site(App $a)
/* Community page style */
$community_page_style_choices = [
CP_NO_INTERNAL_COMMUNITY => L10n::t("No community page for local users"),
CP_NO_COMMUNITY_PAGE => L10n::t("No community page"),
CP_USERS_ON_SERVER => L10n::t("Public postings from users of this site"),
CP_GLOBAL_COMMUNITY => L10n::t("Public postings from the federated network"),

View file

@ -30,6 +30,11 @@ function community_content(App $a, $update = 0)
$page_style = Config::get('system', 'community_page_style');
if ($page_style == CP_NO_INTERNAL_COMMUNITY) {
notice(L10n::t('Access denied.') . EOL);
return;
}
if ($a->argc > 1) {
$content = $a->argv[1];
} else {

View file

@ -161,7 +161,8 @@ class Nav
}
}
if (local_user() || Config::get('system', 'community_page_style') != CP_NO_COMMUNITY_PAGE) {
if ((local_user() || Config::get('system', 'community_page_style') != CP_NO_COMMUNITY_PAGE) &&
!(Config::get('system', 'community_page_style') == CP_NO_INTERNAL_COMMUNITY)) {
$nav['community'] = ['community', L10n::t('Community'), '', L10n::t('Conversations on this and other servers')];
}

View file

@ -851,7 +851,7 @@ class Item extends BaseObject
public static function addShadow($itemid)
{
$fields = ['uid', 'wall', 'private', 'moderated', 'visible', 'contact-id', 'deleted', 'network', 'author-id', 'owner-id'];
$condition = ["`id` = ? AND (`parent` = ? OR `parent` = 0)", $itemid, $itemid];
$condition = ['id' => $itemid, 'parent' => [0, $itemid]];
$item = dba::selectFirst('item', $fields, $condition);
if (!DBM::is_result($item)) {
@ -873,27 +873,9 @@ class Item extends BaseObject
return;
}
// Only do these checks if the post isn't a wall post
if (!$item["wall"]) {
// Check, if hide-friends is activated - then don't do a shadow entry
if (dba::exists('profile', ['is-default' => true, 'uid' => $item['uid'], 'hide-friends' => true])) {
return;
}
// Check if the contact is hidden or blocked
if (!dba::exists('contact', ['hidden' => false, 'blocked' => false, 'id' => $item['contact-id']])) {
return;
}
}
// Only add a shadow, if the profile isn't hidden
if (dba::exists('user', ['uid' => $item['uid'], 'hidewall' => true])) {
return;
}
$item = dba::selectFirst('item', [], ['id' => $itemid]);
if (DBM::is_result($item) && ($item["allow_cid"] == '') && ($item["allow_gid"] == '') &&
if (DBM::is_result($item) && ($item["allow_cid"] == '') && ($item["allow_gid"] == '') &&
($item["deny_cid"] == '') && ($item["deny_gid"] == '')) {
if (!dba::exists('item', ['uri' => $item['uri'], 'uid' => 0])) {