]> git.mxchange.org Git - friendica.git/commitdiff
Progress on #1. Comments are now threaded, at least in the database, for normal view.
authorDomovoy <domovoy@errlock.org>
Mon, 23 Jul 2012 10:56:47 +0000 (12:56 +0200)
committerDomovoy <domovoy@errlock.org>
Mon, 23 Jul 2012 10:56:47 +0000 (12:56 +0200)
include/conversation.php
mod/item.php

index 4a9142bb202285c6553a2a2dd2e2317ea9c914fd..67445c2904fe0417ca77c7b2f14f6a94a4dc5875 100644 (file)
@@ -582,7 +582,9 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
                                }       
 
                                $override_comment_box = ((($page_writeable) && ($item_writeable)) ? true : false);
-                               $show_comment_box = ((($page_writeable) && ($item_writeable) && ($comments_seen == $comments[$item['parent']])) ? true : false);
+                               // The comment box should now appear under each writable item, not only at the end of the thread, don't bother with $comments_seen
+                               //$show_comment_box = ((($page_writeable) && ($item_writeable) && ($comments_seen == $comments[$item['parent']])) ? true : false);
+                               $show_comment_box = ((($page_writeable) && ($item_writeable)) ? true : false);
 
 
                                if(($comments[$item['parent']] > 2) && ($comments_seen <= ($comments[$item['parent']] - 2)) && ($item['gravity'] == 6)) {
@@ -681,12 +683,13 @@ function conversation(&$a, $items, $mode, $update, $preview = false) {
                                        }
 
                                        if(($show_comment_box) || (($show_comment_box == false) && ($override_comment_box == false) && ($item['last-child']))) {
+                                               // The parent is now the item itself, not his parent
                                                $comment = replace_macros($cmnt_tpl,array(
                                                        '$return_path' => '', 
                                                        '$jsreload' => (($mode === 'display') ? $_SESSION['return_url'] : ''),
                                                        '$type' => (($mode === 'profile') ? 'wall-comment' : 'net-comment'),
                                                        '$id' => $item['item_id'],
-                                                       '$parent' => $item['parent'],
+                                                       '$parent' => $item['item_id'],
                                                        '$qcomment' => $qcomment,
                                                        '$profile_uid' =>  $profile_owner,
                                                        '$mylink' => $a->contact['url'],
index fddc3fd124aa3dd49acd989ad82889b9ba9b771c..cc1e628c80c2b0fe3470c07fd068f8a1485e8743 100644 (file)
@@ -77,14 +77,15 @@ function item_post(&$a) {
                        );
                }
                // if this isn't the real parent of the conversation, find it
-               if($r !== false && count($r)) {
+               // We are now threading the comments, the parent may have a parent
+               /*if($r !== false && count($r)) {
                        $parid = $r[0]['parent'];
                        if($r[0]['id'] != $r[0]['parent']) {
                                $r = q("SELECT * FROM `item` WHERE `id` = `parent` AND `parent` = %d LIMIT 1",
                                        intval($parid)
                                );
                        }
-               }
+               }*/
 
                if(($r === false) || (! count($r))) {
                        notice( t('Unable to locate original post.') . EOL);