Public commenting is now always enabled
This commit is contained in:
parent
28d79281a9
commit
03aafa8228
3 changed files with 23 additions and 40 deletions
|
@ -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');
|
if ($mode === 'community') {
|
||||||
|
$writable = true;
|
||||||
// Currently behind a config value. This allows the commenting and sharing of every public item.
|
|
||||||
if (Config::get('system', 'comment_public')) {
|
|
||||||
if ($mode === 'community') {
|
|
||||||
$community_readonly = false;
|
|
||||||
$writable = true;
|
|
||||||
} else {
|
|
||||||
$writable = ($items[0]['uid'] == 0) && in_array($items[0]['network'], [NETWORK_OSTATUS, NETWORK_DIASPORA, NETWORK_DFRN]);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$writable = false;
|
$writable = ($items[0]['uid'] == 0) && in_array($items[0]['network'], [NETWORK_OSTATUS, NETWORK_DIASPORA, NETWORK_DFRN]);
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
||||||
|
|
|
@ -114,24 +114,21 @@ 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
|
if ($a->is_mobile) {
|
||||||
// accordingly
|
$itemspage_network = PConfig::get(local_user(), 'system', 'itemspage_mobile_network', 20);
|
||||||
if ($a->is_mobile) {
|
} else {
|
||||||
$itemspage_network = PConfig::get(local_user(), 'system', 'itemspage_mobile_network', 20);
|
$itemspage_network = PConfig::get(local_user(), 'system', 'itemspage_network', 40);
|
||||||
} else {
|
|
||||||
$itemspage_network = PConfig::get(local_user(), 'system', 'itemspage_network', 40);
|
|
||||||
}
|
|
||||||
|
|
||||||
// now that we have the user settings, see if the theme forces
|
|
||||||
// a maximum item number which is lower then the user choice
|
|
||||||
if (($a->force_max_items > 0) && ($a->force_max_items < $itemspage_network)) {
|
|
||||||
$itemspage_network = $a->force_max_items;
|
|
||||||
}
|
|
||||||
|
|
||||||
$a->set_pager_itemspage($itemspage_network);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// now that we have the user settings, see if the theme forces
|
||||||
|
// a maximum item number which is lower then the user choice
|
||||||
|
if (($a->force_max_items > 0) && ($a->force_max_items < $itemspage_network)) {
|
||||||
|
$itemspage_network = $a->force_max_items;
|
||||||
|
}
|
||||||
|
|
||||||
|
$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);
|
||||||
|
|
||||||
if (!DBM::is_result($r)) {
|
if (!DBM::is_result($r)) {
|
||||||
|
@ -198,12 +195,10 @@ function community_getitems($start, $itemspage, $content)
|
||||||
);
|
);
|
||||||
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'];
|
||||||
|
|
Loading…
Reference in a new issue