getting comment counts correct in a threaded world
This commit is contained in:
parent
95bf9324b4
commit
d4b6188356
|
@ -305,11 +305,11 @@ function localize_item(&$item){
|
||||||
function count_descendants($item) {
|
function count_descendants($item) {
|
||||||
$total = count($item['children']);
|
$total = count($item['children']);
|
||||||
|
|
||||||
if($item['verb'] === ACTIVITY_LIKE || $item['verb'] === ACTIVITY_DISLIKE)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if($total > 0) {
|
if($total > 0) {
|
||||||
foreach($item['children'] as $child) {
|
foreach($item['children'] as $child) {
|
||||||
|
if($child['verb'] === ACTIVITY_LIKE || $child['verb'] === ACTIVITY_DISLIKE) {
|
||||||
|
$total --;
|
||||||
|
}
|
||||||
$total += count_descendants($child);
|
$total += count_descendants($child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -332,17 +332,25 @@ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $pr
|
||||||
$total_children = $nb_items;
|
$total_children = $nb_items;
|
||||||
|
|
||||||
foreach($items as $item) {
|
foreach($items as $item) {
|
||||||
// prevent private email reply to public conversation from leaking.
|
|
||||||
if($item['network'] === NETWORK_MAIL && local_user() != $item['uid']) {
|
if($item['network'] === NETWORK_MAIL && local_user() != $item['uid']) {
|
||||||
// Don't count it as a visible item
|
// Don't count it as a visible item
|
||||||
$nb_items--;
|
$nb_items--;
|
||||||
$total_children = $nb_items;
|
$total_children --;
|
||||||
|
}
|
||||||
|
if($item['verb'] === ACTIVITY_LIKE || $item['verb'] === ACTIVITY_DISLIKE) {
|
||||||
|
$nb_items --;
|
||||||
|
$total_children --;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($items as $item) {
|
||||||
|
// prevent private email reply to public conversation from leaking.
|
||||||
|
if($item['network'] === NETWORK_MAIL && local_user() != $item['uid']) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($item['verb'] === ACTIVITY_LIKE || $item['verb'] === ACTIVITY_DISLIKE) {
|
if($item['verb'] === ACTIVITY_LIKE || $item['verb'] === ACTIVITY_DISLIKE) {
|
||||||
$nb_items --;
|
|
||||||
$total_children = $nb_items;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue