A possible configuration that doesn't seem to be covered by ajax_comments is replying to a comment in a flat list. If, in the content type settings, the "threading" checkbox is unchecked, all comments should be shown in a first to last format. However ajax_comments will always append the new comment reply to it's parent comment. Of course then when the page is refreshed the new comment will appear at the end of the list.

I think the issue can be solved here in ajax_comments_submit_js() by checking for the threading variable:

// Or are we replying to another comment.
  elseif (isset($form_state['values']['pid']) && variable_get('comment_default_mode_' . $node->type) == COMMENT_MODE_THREADED) {
    // Append comment to parent wrapper.
    $comment_output = drupal_render($comment_build);
    $commands[] = ajax_command_append('#comment-wrapper-' . $comment->pid, $notify_text . $comment_output);
    // Delete the form.
    $commands[] = ajax_command_invoke('#' . $form['#id'], 'remove');

If this looks right I'd be happy to submit a patch.

Members fund testing for the Drupal project. Drupal Association Learn more


RgnYLDZ’s picture

I think I have a similar problem. I set my comments to list the newest on top with comment goodness (Like facebook wall). When I use ajax comments the comment is added as a reply to the first comment at the bottom (Not the newest on top). Also the text is not removed after posting the comment.

Could this be related ?

Applying the && variable_get('comment_default_mode_' . $node->type) == COMMENT_MODE_THREADED gave me a views_ajax_submission error.

RgnYLDZ’s picture


views_ajax_submission error is irrelevant and an error on it's own. I'll open an issue soon.

Also the comment text not removing after post is about https://www.drupal.org/node/2294195 this post and related to comment_goodness.

formatC'vt’s picture

Assigned: Unassigned » formatC'vt
Status: Active » Needs work

@Sarenc Bug confirmed.
@RgnYLDZ not sure, maybe ajax_comments is not compatible with comment_goodness module

formatC'vt’s picture

Status: Needs work » Needs review
2.69 KB

Comment deletion in flat mode also has problems.
All bugs in flat mode has been fixed. I hope =)

formatC'vt’s picture

@RgnYLDZ about comment_goodness, you can try patch from #2320845: Make 7.x-1.x-dev version work. Part 2.

muschpusch’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.