]> git.mxchange.org Git - friendica.git/commitdiff
bring likes back - comment ordering is still a bit funky
authorfriendica <info@friendica.com>
Fri, 10 Aug 2012 23:36:44 +0000 (16:36 -0700)
committerfriendica <info@friendica.com>
Fri, 10 Aug 2012 23:36:44 +0000 (16:36 -0700)
include/conversation.php
view/wall_thread.tpl
view/wallwall_thread.tpl

index 68aa1fa33c3c8399f4df2b4783976ead38344b73..df076de3aea387a94bbde7b85eaa04726e2d1a8b 100644 (file)
@@ -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);
                }
        }
                
index 600f755b12cd69c6592ca30be2f0d370ecb7d271..6f7ced7fe285480d8189b17eb00fc2c3d63c9047 100644 (file)
                        </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>
+               </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" >
+                       <div class="wall-item-comment-wrapper$item.indent" >
                                $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>
+
 <div class="wall-item-outside-wrapper-end$item.indent" ></div>
 </div>
 {{ for $item.children as $item }}
 {{ endif }}
 </div>
 {{if $item.comment_lastcollapsed}}</div>{{endif}}
+
index 89f121f21046c0e4aa9d32734f3a17d9ddef3c5b..63799664c40ae0314c6ef780f0287f9dfc158f3a 100644 (file)
                        </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>
+               </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" >
+                       <div class="wall-item-comment-wrapper$item.indent" >
                                $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>
+
 <div class="wall-item-outside-wrapper-end$item.indent" ></div>
 </div>
 {{ for $item.children as $item }}