diff --git a/include/conversation.php b/include/conversation.php index 68aa1fa33..df076de3a 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -305,6 +305,9 @@ function localize_item(&$item){ 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) { $total += count_descendants($child); @@ -318,7 +321,7 @@ function count_descendants($item) { * Recursively prepare a thread for HTML */ -function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $profile_owner, $thread_level=1) { +function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $profile_owner, $alike, $dlike, $thread_level=1) { $result = array(); $wall_template = 'wall_thread.tpl'; @@ -335,11 +338,14 @@ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $pr $nb_items--; continue; } + + if($item['verb'] === ACTIVITY_LIKE || $item['verb'] === ACTIVITY_DISLIKE) { + $nb_items --; + continue; + } $items_seen++; - $alike = array(); - $dlike = array(); $comment = ''; $template = $wall_template; $commentww = ''; @@ -410,9 +416,6 @@ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $pr $tag = trim($tag); if ($tag!="") $tags[] = bbcode($tag); } - - like_puller($a,$item,$alike,'like'); - like_puller($a,$item,$dlike,'dislike'); $like = ((x($alike,$item['uri'])) ? format_like($alike[$item['uri']],$alike[$item['uri'] . '-l'],'like',$item['uri']) : ''); $dislike = ((x($dlike,$item['uri'])) ? format_like($dlike[$item['uri']],$dlike[$item['uri'] . '-l'],'dislike',$item['uri']) : ''); @@ -602,7 +605,7 @@ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $pr $item_result['children'] = array(); if(count($item['children'])) { - $item_result['children'] = prepare_threads_body($a, $item['children'], $cmnt_tpl, $page_writeable, $mode, $profile_owner, ($thread_level + 1)); + $item_result['children'] = prepare_threads_body($a, $item['children'], $cmnt_tpl, $page_writeable, $mode, $profile_owner, $alike, $dlike, ($thread_level + 1)); } $item_result['private'] = $item['private']; $item_result['toplevel'] = ($toplevelpost ? 'toplevel_item' : ''); @@ -842,12 +845,16 @@ function conversation(&$a, $items, $mode, $update, $preview = false) { $threads = array(); foreach($items as $item) { + + like_puller($a,$item,$alike,'like'); + like_puller($a,$item,$dlike,'dislike'); + if($item['id'] == $item['parent']) { $threads[] = $item; } } - $threads = prepare_threads_body($a, $threads, $cmnt_tpl, $page_writeable, $mode, $profile_owner); + $threads = prepare_threads_body($a, $threads, $cmnt_tpl, $page_writeable, $mode, $profile_owner, $alike, $dlike); } } diff --git a/view/wall_thread.tpl b/view/wall_thread.tpl index 600f755b1..6f7ced7fe 100644 --- a/view/wall_thread.tpl +++ b/view/wall_thread.tpl @@ -73,18 +73,20 @@ {{ if $item.drop.dropping }}{{ endif }}
- {{ if $item.threaded }} - {{ if $item.comment }} -
- $item.comment -
- {{ endif }} - {{ endif }}
$item.like
$item.dislike
+ + {{ if $item.threaded }} + {{ if $item.comment }} +
+ $item.comment +
+ {{ endif }} + {{ endif }} +
{{ for $item.children as $item }} @@ -98,3 +100,4 @@ {{ endif }} {{if $item.comment_lastcollapsed}}{{endif}} + diff --git a/view/wallwall_thread.tpl b/view/wallwall_thread.tpl index 89f121f21..63799664c 100644 --- a/view/wallwall_thread.tpl +++ b/view/wallwall_thread.tpl @@ -78,18 +78,20 @@ {{ if $item.drop.dropping }}{{ endif }}
- {{ if $item.threaded }} - {{ if $item.comment }} -
- $item.comment -
- {{ endif }} - {{ endif }}
$item.like
$item.dislike
+ + {{ if $item.threaded }} + {{ if $item.comment }} +
+ $item.comment +
+ {{ endif }} + {{ endif }} +
{{ for $item.children as $item }}