Merge pull request #4371 from annando/public-commenting
Public commenting is now always enabled
This commit is contained in:
commit
2a53186ef1
2
boot.php
2
boot.php
|
@ -39,7 +39,7 @@ define('FRIENDICA_PLATFORM', 'Friendica');
|
||||||
define('FRIENDICA_CODENAME', 'Asparagus');
|
define('FRIENDICA_CODENAME', 'Asparagus');
|
||||||
define('FRIENDICA_VERSION', '3.6-dev');
|
define('FRIENDICA_VERSION', '3.6-dev');
|
||||||
define('DFRN_PROTOCOL_VERSION', '2.23');
|
define('DFRN_PROTOCOL_VERSION', '2.23');
|
||||||
define('DB_UPDATE_VERSION', 1247);
|
define('DB_UPDATE_VERSION', 1248);
|
||||||
define('NEW_UPDATE_ROUTINE_VERSION', 1170);
|
define('NEW_UPDATE_ROUTINE_VERSION', 1170);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
-- ------------------------------------------
|
-- ------------------------------------------
|
||||||
-- Friendica 3.6-dev (Asparagus)
|
-- Friendica 3.6-dev (Asparagus)
|
||||||
-- DB_UPDATE_VERSION 1246
|
-- DB_UPDATE_VERSION 1248
|
||||||
-- ------------------------------------------
|
-- ------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
@ -982,7 +982,7 @@ CREATE TABLE IF NOT EXISTS `thread` (
|
||||||
INDEX `uid_created` (`uid`,`created`),
|
INDEX `uid_created` (`uid`,`created`),
|
||||||
INDEX `uid_commented` (`uid`,`commented`),
|
INDEX `uid_commented` (`uid`,`commented`),
|
||||||
INDEX `uid_wall_created` (`uid`,`wall`,`created`),
|
INDEX `uid_wall_created` (`uid`,`wall`,`created`),
|
||||||
INDEX `private_wall_commented` (`private`,`wall`,`commented`)
|
INDEX `private_wall_origin_commented` (`private`,`wall`,`origin`,`commented`)
|
||||||
) DEFAULT COLLATE utf8mb4_general_ci;
|
) DEFAULT COLLATE utf8mb4_general_ci;
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|
|
@ -15,6 +15,11 @@ General
|
||||||
* f: notifications
|
* f: notifications
|
||||||
* u: user menu (in themes "vier" and "quattro")
|
* u: user menu (in themes "vier" and "quattro")
|
||||||
|
|
||||||
|
/community
|
||||||
|
--------
|
||||||
|
* l: Local community
|
||||||
|
* g: Global community
|
||||||
|
|
||||||
/profile
|
/profile
|
||||||
--------
|
--------
|
||||||
* m: Status Messages and Posts
|
* m: Status Messages and Posts
|
||||||
|
|
|
@ -578,9 +578,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
|
||||||
. " var profile_page = 1; </script>";
|
. " var profile_page = 1; </script>";
|
||||||
}
|
}
|
||||||
} elseif ($mode === 'community') {
|
} elseif ($mode === 'community') {
|
||||||
if (!$community_readonly) {
|
|
||||||
$items = community_add_items($items);
|
$items = community_add_items($items);
|
||||||
}
|
|
||||||
$profile_owner = 0;
|
$profile_owner = 0;
|
||||||
if (!$update) {
|
if (!$update) {
|
||||||
$live_update_div = '<div id="live-community"></div>' . "\r\n"
|
$live_update_div = '<div id="live-community"></div>' . "\r\n"
|
||||||
|
@ -614,33 +612,23 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
|
||||||
$page_template = get_markup_template("conversation.tpl");
|
$page_template = get_markup_template("conversation.tpl");
|
||||||
|
|
||||||
if ($items && count($items)) {
|
if ($items && count($items)) {
|
||||||
$community_readonly = ($mode === 'community');
|
|
||||||
|
|
||||||
// Currently behind a config value. This allows the commenting and sharing of every public item.
|
|
||||||
if (Config::get('system', 'comment_public')) {
|
|
||||||
if ($mode === 'community') {
|
if ($mode === 'community') {
|
||||||
$community_readonly = false;
|
|
||||||
$writable = true;
|
$writable = true;
|
||||||
} else {
|
} else {
|
||||||
$writable = ($items[0]['uid'] == 0) && in_array($items[0]['network'], [NETWORK_OSTATUS, NETWORK_DIASPORA, NETWORK_DFRN]);
|
$writable = ($items[0]['uid'] == 0) && in_array($items[0]['network'], [NETWORK_OSTATUS, NETWORK_DIASPORA, NETWORK_DFRN]);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$writable = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
$writable = false;
|
$writable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($mode, ['network-new', 'search', 'contact-posts']) || $community_readonly) {
|
if (in_array($mode, ['network-new', 'search', 'contact-posts'])) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* "New Item View" on network page or search page results
|
* "New Item View" on network page or search page results
|
||||||
* - just loop through the items and format them minimally for display
|
* - just loop through the items and format them minimally for display
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/// @TODO old lost code?
|
|
||||||
// $tpl = get_markup_template('search_item.tpl');
|
|
||||||
$tpl = 'search_item.tpl';
|
$tpl = 'search_item.tpl';
|
||||||
|
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
|
|
|
@ -72,7 +72,7 @@ function community_content(App $a, $update = 0)
|
||||||
|
|
||||||
if ((local_user() || in_array($page_style, [CP_USERS_AND_GLOBAL, CP_USERS_ON_SERVER])) && empty(Config::get('system', 'singleuser'))) {
|
if ((local_user() || in_array($page_style, [CP_USERS_AND_GLOBAL, CP_USERS_ON_SERVER])) && empty(Config::get('system', 'singleuser'))) {
|
||||||
$tabs[] = [
|
$tabs[] = [
|
||||||
'label' => L10n::t('Community'),
|
'label' => L10n::t('Local Community'),
|
||||||
'url' => 'community/local',
|
'url' => 'community/local',
|
||||||
'sel' => $content == 'local' ? 'active' : '',
|
'sel' => $content == 'local' ? 'active' : '',
|
||||||
'title' => L10n::t('Posts from local users on this server'),
|
'title' => L10n::t('Posts from local users on this server'),
|
||||||
|
@ -83,10 +83,10 @@ function community_content(App $a, $update = 0)
|
||||||
|
|
||||||
if (local_user() || in_array($page_style, [CP_USERS_AND_GLOBAL, CP_GLOBAL_COMMUNITY])) {
|
if (local_user() || in_array($page_style, [CP_USERS_AND_GLOBAL, CP_GLOBAL_COMMUNITY])) {
|
||||||
$tabs[] = [
|
$tabs[] = [
|
||||||
'label' => L10n::t('Global Timeline'),
|
'label' => L10n::t('Global Community'),
|
||||||
'url' => 'community/global',
|
'url' => 'community/global',
|
||||||
'sel' => $content == 'global' ? 'active' : '',
|
'sel' => $content == 'global' ? 'active' : '',
|
||||||
'title' => L10n::t('Posts from users of the federated network'),
|
'title' => L10n::t('Posts from users of the whole federated network'),
|
||||||
'id' => 'community-global-tab',
|
'id' => 'community-global-tab',
|
||||||
'accesskey' => 'g'
|
'accesskey' => 'g'
|
||||||
];
|
];
|
||||||
|
@ -114,9 +114,7 @@ function community_content(App $a, $update = 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config::get('system', 'comment_public')) {
|
// check if we serve a mobile device and get the user settings accordingly
|
||||||
// check if we serve a mobile device and get the user settings
|
|
||||||
// accordingly
|
|
||||||
if ($a->is_mobile) {
|
if ($a->is_mobile) {
|
||||||
$itemspage_network = PConfig::get(local_user(), 'system', 'itemspage_mobile_network', 20);
|
$itemspage_network = PConfig::get(local_user(), 'system', 'itemspage_mobile_network', 20);
|
||||||
} else {
|
} else {
|
||||||
|
@ -130,7 +128,6 @@ function community_content(App $a, $update = 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
$a->set_pager_itemspage($itemspage_network);
|
$a->set_pager_itemspage($itemspage_network);
|
||||||
}
|
|
||||||
|
|
||||||
$r = community_getitems($a->pager['start'], $a->pager['itemspage'], $content);
|
$r = community_getitems($a->pager['start'], $a->pager['itemspage'], $content);
|
||||||
|
|
||||||
|
@ -186,24 +183,19 @@ function community_content(App $a, $update = 0)
|
||||||
function community_getitems($start, $itemspage, $content)
|
function community_getitems($start, $itemspage, $content)
|
||||||
{
|
{
|
||||||
if ($content == 'local') {
|
if ($content == 'local') {
|
||||||
$r = dba::p("SELECT " . item_fieldlists() . " FROM `thread`
|
$r = dba::p("SELECT `item`.`uri`, `item`.`author-link` FROM `thread`
|
||||||
INNER JOIN `user` ON `user`.`uid` = `thread`.`uid` AND NOT `user`.`hidewall`
|
INNER JOIN `user` ON `user`.`uid` = `thread`.`uid` AND NOT `user`.`hidewall`
|
||||||
INNER JOIN `item` ON `item`.`id` = `thread`.`iid`
|
INNER JOIN `item` ON `item`.`id` = `thread`.`iid`
|
||||||
AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''
|
|
||||||
AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = ''" .
|
|
||||||
item_joins() . " AND `contact`.`self`
|
|
||||||
WHERE `thread`.`visible` AND NOT `thread`.`deleted` AND NOT `thread`.`moderated`
|
WHERE `thread`.`visible` AND NOT `thread`.`deleted` AND NOT `thread`.`moderated`
|
||||||
AND NOT `thread`.`private` AND `thread`.`wall`
|
AND NOT `thread`.`private` AND `thread`.`wall` AND `thread`.`origin`
|
||||||
ORDER BY `thread`.`commented` DESC LIMIT " . intval($start) . ", " . intval($itemspage)
|
ORDER BY `thread`.`commented` DESC LIMIT " . intval($start) . ", " . intval($itemspage)
|
||||||
);
|
);
|
||||||
return dba::inArray($r);
|
return dba::inArray($r);
|
||||||
} elseif ($content == 'global') {
|
} elseif ($content == 'global') {
|
||||||
$r = dba::p("SELECT " . item_fieldlists() . " FROM `thread`
|
$r = dba::p("SELECT `uri` FROM `thread`
|
||||||
INNER JOIN `item` ON `item`.`id` = `thread`.`iid` " . item_joins() .
|
INNER JOIN `item` ON `item`.`id` = `thread`.`iid`
|
||||||
"WHERE `thread`.`uid` = 0 AND `verb` = ?
|
WHERE `thread`.`uid` = 0
|
||||||
ORDER BY `thread`.`commented` DESC LIMIT " . intval($start) . ", " . intval($itemspage),
|
ORDER BY `thread`.`commented` DESC LIMIT " . intval($start) . ", " . intval($itemspage));
|
||||||
ACTIVITY_POST
|
|
||||||
);
|
|
||||||
return dba::inArray($r);
|
return dba::inArray($r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -783,7 +783,7 @@ function networkThreadedView(App $a, $update = 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only show it when unfiltered (no groups, no networks, ...)
|
// Only show it when unfiltered (no groups, no networks, ...)
|
||||||
if (Config::get('system', 'comment_public') && in_array($nets, ['', NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS]) && (strlen($sql_extra . $sql_extra2 . $sql_extra3) == 0)) {
|
if (in_array($nets, ['', NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS]) && (strlen($sql_extra . $sql_extra2 . $sql_extra3) == 0)) {
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
$top_limit = current($r)['order_date'];
|
$top_limit = current($r)['order_date'];
|
||||||
$bottom_limit = end($r)['order_date'];
|
$bottom_limit = end($r)['order_date'];
|
||||||
|
|
|
@ -1686,7 +1686,7 @@ class DBStructure
|
||||||
"uid_created" => ["uid","created"],
|
"uid_created" => ["uid","created"],
|
||||||
"uid_commented" => ["uid","commented"],
|
"uid_commented" => ["uid","commented"],
|
||||||
"uid_wall_created" => ["uid","wall","created"],
|
"uid_wall_created" => ["uid","wall","created"],
|
||||||
"private_wall_commented" => ["private","wall","commented"],
|
"private_wall_origin_commented" => ["private","wall","origin","commented"],
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
$database["tokens"] = [
|
$database["tokens"] = [
|
||||||
|
|
Loading…
Reference in a new issue