--- modules/comment/comment.module 2008-02-02 03:21:31.000000000 +0000
+++ modules/comment/comment.module 2008-02-02 03:43:45.000000000 +0000
@@ -988,7 +988,6 @@
// Start a form, for use with comment control.
$result = pager_query($query, $comments_per_page, 0, $query_count, $query_args);
- $divs = 0;
$num_rows = FALSE;
$comments = '';
drupal_add_css(drupal_get_path('module', 'comment') .'/comment.css');
@@ -997,19 +996,6 @@
$comment->name = $comment->uid ? $comment->registered_name : $comment->name;
$comment->depth = count(explode('.', $comment->thread)) - 1;
- if ($mode == COMMENT_MODE_THREADED_COLLAPSED || $mode == COMMENT_MODE_THREADED_EXPANDED) {
- if ($comment->depth > $divs) {
- $divs++;
- $comments .= '
';
- }
- else {
- while ($comment->depth < $divs) {
- $divs--;
- $comments .= '
';
- }
- }
- }
-
if ($mode == COMMENT_MODE_FLAT_COLLAPSED) {
$comments .= theme('comment_flat_collapsed', $comment, $node);
}
@@ -1025,9 +1011,10 @@
$num_rows = TRUE;
}
- while ($divs-- > 0) {
- $comments .= '';
- }
+ // De-indent to correct depth
+ $comment->cid = NULL;
+ $comment->depth = 0;
+ theme('comment_view', $comment, $node, '');
$comment_controls = variable_get('comment_controls_'. $node->type, COMMENT_CONTROLS_HIDDEN);
if ($num_rows && ($comment_controls == COMMENT_CONTROLS_ABOVE || $comment_controls == COMMENT_CONTROLS_ABOVE_BELOW)) {
@@ -1557,8 +1544,25 @@
*/
function theme_comment_view($comment, $node, $links = array(), $visible = TRUE) {
static $first_new = TRUE;
+ static $divs = 0;
$output = '';
+ $mode = _comment_get_display_setting('mode', $node);
+ if ($mode == COMMENT_MODE_THREADED_COLLAPSED || $mode == COMMENT_MODE_THREADED_EXPANDED) {
+ if ($comment->depth > $divs) {
+ $divs++;
+ $output .= '';
+ }
+ else {
+ while ($comment->depth < $divs) {
+ $divs--;
+ $output .= '
';
+ }
+ }
+ }
+ if (!isset($comment->cid)) {
+ return $output;
+ }
$comment->new = node_mark($comment->nid, $comment->timestamp);
if ($first_new && $comment->new != MARK_READ) {
// Assign the anchor only for the first new comment. This avoids duplicate