I'm a relative newbie to Drupal. I'm not actively running a site on it, but I downloaded the 5.0-beta1 to check it out.

I set my Default display mode for Comments to: Flat list - expanded. But when I added some comment replies to a story, they still have the indented "outline" look.

Smells like a bug to me, but it's also possible that I don't know what I'm doing. :)

CommentFileSizeAuthor
#3 patch_78.txt1.3 KBwebernet
#2 comment.module_63.patch888 bytesjclifton
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jclifton’s picture

Title: Flat comments not working? » Here's a fix ...

stevenf,

The problem appears to be that the code in comment.module doesn't check to see if the comment mode is flat before wrapping the comment in a DIV tag that gets formatted as indented. If you replace the code in the module in lines 901-908 with the following, that will fix the problem:

        if ($comment->depth > $last_depth) {
          if ($mode == COMMENT_MODE_THREADED_COLLAPSED or $mode == COMMENT_MODE_THREADED_EXPANDED) {
            $divs++;
            $output .= '<div class="indented">';
          }
        }
        else if ($comment->depth < $last_depth) {
          if ($mode == COMMENT_MODE_THREADED_COLLAPSED or $mode == COMMENT_MODE_THREADED_EXPANDED) {
            $divs--;
            $output .= '</div>';
          }
        }
jclifton’s picture

Title: Here's a fix ... » Flat comments not working?
FileSize
888 bytes

Here's a patch that fixes the problem.

webernet’s picture

Version: 5.0-beta1 » 5.x-dev
Status: Active » Needs review
FileSize
1.3 KB

Patch changes it so the indentation divs are only added for threaded modes.

webernet’s picture

Title: Flat comments not working? » Flat comments are broken
Priority: Normal » Critical

Bumping to critical since this needs to be fixed for RC1.

merlinofchaos’s picture

Shouldn't the depth remain static if we're not threaded? Meaning those divs should never be applied?

That might simply mean that our *starting* $last_depth is wrong, and assigning $last_depth = 1 could also fix it. Anyone got a testbed that can quickly check me on this?

merlinofchaos’s picture

Allow me to clarify, because apparently I don't make sense today.

In this code, a div is only added if ($comment->depth != $last_depth).

That test should only be true if comments are threaded.

Therefore we should not need to test explicitly as to whether or not comments are threaded. Instead, I believe this means that have $last_depth set incorrectly, which not only means that flat comments are indented, but all comments are indented one extra level whether or not they are threaded.

merlinofchaos’s picture

Also, apparently I am completely wrong about this. In which case webernet's patch looks good.

ChrisKennedy’s picture

Title: Flat comments are broken » Flat comments displayed as threaded
Status: Needs review » Reviewed & tested by the community

Tested and works fine.

FiNeX’s picture

The patch works right!

Anonymous’s picture

tested and works good for me.

Steven’s picture

Status: Reviewed & tested by the community » Fixed

Tested and verified. Committed to HEAD. Thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)