bring likes back - comment ordering is still a bit funky
This commit is contained in:
parent
ed7e626ed2
commit
20be1778db
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -73,18 +73,20 @@
|
|||
</div>
|
||||
{{ if $item.drop.dropping }}<input type="checkbox" onclick="checkboxhighlight(this);" title="$item.drop.select" class="item-select" name="itemselected[]" value="$item.id" />{{ endif }}
|
||||
<div class="wall-item-delete-end"></div>
|
||||
{{ if $item.threaded }}
|
||||
{{ if $item.comment }}
|
||||
<div class="wall-item-comment-wrapper" >
|
||||
$item.comment
|
||||
</div>
|
||||
{{ endif }}
|
||||
{{ endif }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="wall-item-wrapper-end"></div>
|
||||
<div class="wall-item-like $item.indent" id="wall-item-like-$item.id">$item.like</div>
|
||||
<div class="wall-item-dislike $item.indent" id="wall-item-dislike-$item.id">$item.dislike</div>
|
||||
|
||||
{{ if $item.threaded }}
|
||||
{{ if $item.comment }}
|
||||
<div class="wall-item-comment-wrapper$item.indent" >
|
||||
$item.comment
|
||||
</div>
|
||||
{{ endif }}
|
||||
{{ endif }}
|
||||
|
||||
<div class="wall-item-outside-wrapper-end$item.indent" ></div>
|
||||
</div>
|
||||
{{ for $item.children as $item }}
|
||||
|
@ -98,3 +100,4 @@
|
|||
{{ endif }}
|
||||
</div>
|
||||
{{if $item.comment_lastcollapsed}}</div>{{endif}}
|
||||
|
||||
|
|
|
@ -78,18 +78,20 @@
|
|||
</div>
|
||||
{{ if $item.drop.dropping }}<input type="checkbox" onclick="checkboxhighlight(this);" title="$item.drop.select" class="item-select" name="itemselected[]" value="$item.id" />{{ endif }}
|
||||
<div class="wall-item-delete-end"></div>
|
||||
{{ if $item.threaded }}
|
||||
{{ if $item.comment }}
|
||||
<div class="wall-item-comment-wrapper" >
|
||||
$item.comment
|
||||
</div>
|
||||
{{ endif }}
|
||||
{{ endif }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="wall-item-wrapper-end"></div>
|
||||
<div class="wall-item-like $item.indent" id="wall-item-like-$item.id">$item.like</div>
|
||||
<div class="wall-item-dislike $item.indent" id="wall-item-dislike-$item.id">$item.dislike</div>
|
||||
|
||||
{{ if $item.threaded }}
|
||||
{{ if $item.comment }}
|
||||
<div class="wall-item-comment-wrapper$item.indent" >
|
||||
$item.comment
|
||||
</div>
|
||||
{{ endif }}
|
||||
{{ endif }}
|
||||
|
||||
<div class="wall-item-outside-wrapper-end$item.indent" ></div>
|
||||
</div>
|
||||
{{ for $item.children as $item }}
|
||||
|
|
Loading…
Reference in a new issue