function count_descendants($item) {
$total = count($item['children']);
- if($item['verb'] === ACTIVITY_LIKE || $item['verb'] === ACTIVITY_DISLIKE)
- return 0;
-
if($total > 0) {
foreach($item['children'] as $child) {
+ if($child['verb'] === ACTIVITY_LIKE || $child['verb'] === ACTIVITY_DISLIKE) {
+ $total --;
+ }
$total += count_descendants($child);
}
}
$total_children = $nb_items;
foreach($items as $item) {
- // prevent private email reply to public conversation from leaking.
if($item['network'] === NETWORK_MAIL && local_user() != $item['uid']) {
// Don't count it as a visible item
$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;
}
if($item['verb'] === ACTIVITY_LIKE || $item['verb'] === ACTIVITY_DISLIKE) {
- $nb_items --;
- $total_children = $nb_items;
continue;
}