mirror of
https://github.com/friendica/friendica
synced 2025-01-11 13:24:43 +00:00
bring likes back - comment ordering is still a bit funky
This commit is contained in:
parent
ed7e626ed2
commit
20be1778db
3 changed files with 34 additions and 22 deletions
|
@ -305,6 +305,9 @@ 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) {
|
||||||
$total += count_descendants($child);
|
$total += count_descendants($child);
|
||||||
|
@ -318,7 +321,7 @@ function count_descendants($item) {
|
||||||
* Recursively prepare a thread for HTML
|
* 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();
|
$result = array();
|
||||||
|
|
||||||
$wall_template = 'wall_thread.tpl';
|
$wall_template = 'wall_thread.tpl';
|
||||||
|
@ -336,10 +339,13 @@ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $pr
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($item['verb'] === ACTIVITY_LIKE || $item['verb'] === ACTIVITY_DISLIKE) {
|
||||||
|
$nb_items --;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$items_seen++;
|
$items_seen++;
|
||||||
|
|
||||||
$alike = array();
|
|
||||||
$dlike = array();
|
|
||||||
$comment = '';
|
$comment = '';
|
||||||
$template = $wall_template;
|
$template = $wall_template;
|
||||||
$commentww = '';
|
$commentww = '';
|
||||||
|
@ -411,9 +417,6 @@ function prepare_threads_body($a, $items, $cmnt_tpl, $page_writeable, $mode, $pr
|
||||||
if ($tag!="") $tags[] = bbcode($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']) : '');
|
$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']) : '');
|
$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();
|
$item_result['children'] = array();
|
||||||
if(count($item['children'])) {
|
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['private'] = $item['private'];
|
||||||
$item_result['toplevel'] = ($toplevelpost ? 'toplevel_item' : '');
|
$item_result['toplevel'] = ($toplevelpost ? 'toplevel_item' : '');
|
||||||
|
@ -842,12 +845,16 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
|
||||||
|
|
||||||
$threads = array();
|
$threads = array();
|
||||||
foreach($items as $item) {
|
foreach($items as $item) {
|
||||||
|
|
||||||
|
like_puller($a,$item,$alike,'like');
|
||||||
|
like_puller($a,$item,$dlike,'dislike');
|
||||||
|
|
||||||
if($item['id'] == $item['parent']) {
|
if($item['id'] == $item['parent']) {
|
||||||
$threads[] = $item;
|
$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>
|
</div>
|
||||||
{{ if $item.drop.dropping }}<input type="checkbox" onclick="checkboxhighlight(this);" title="$item.drop.select" class="item-select" name="itemselected[]" value="$item.id" />{{ endif }}
|
{{ 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>
|
<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>
|
</div>
|
||||||
<div class="wall-item-wrapper-end"></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-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>
|
<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 class="wall-item-outside-wrapper-end$item.indent" ></div>
|
||||||
</div>
|
</div>
|
||||||
{{ for $item.children as $item }}
|
{{ for $item.children as $item }}
|
||||||
|
@ -98,3 +100,4 @@
|
||||||
{{ endif }}
|
{{ endif }}
|
||||||
</div>
|
</div>
|
||||||
{{if $item.comment_lastcollapsed}}</div>{{endif}}
|
{{if $item.comment_lastcollapsed}}</div>{{endif}}
|
||||||
|
|
||||||
|
|
|
@ -78,18 +78,20 @@
|
||||||
</div>
|
</div>
|
||||||
{{ if $item.drop.dropping }}<input type="checkbox" onclick="checkboxhighlight(this);" title="$item.drop.select" class="item-select" name="itemselected[]" value="$item.id" />{{ endif }}
|
{{ 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>
|
<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>
|
</div>
|
||||||
<div class="wall-item-wrapper-end"></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-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>
|
<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 class="wall-item-outside-wrapper-end$item.indent" ></div>
|
||||||
</div>
|
</div>
|
||||||
{{ for $item.children as $item }}
|
{{ for $item.children as $item }}
|
||||||
|
|
Loading…
Reference in a new issue