Skip to:
Content

BuddyPress.org

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#6797 closed defect (bug) (fixed)

BuddyPress breaks Ajax comments in edit post screen

Reported by: imath's profile imath Owned by: imath's profile imath
Milestone: 2.5 Priority: high
Severity: blocker Version:
Component: Administration Keywords: has-patch
Cc:

Description

Just noticed this, i don't know what changed after the 2.4 branch, but i have a very weird behavior into the Post and Page edit screen.

Since 2.5.0-alpha, if you go into the edit screen of "hello world" post and check 'Comments' within the screen options, inside comments meta box: the comments are never displayed and adding a comment doesn't refresh the list and leave the comment form as is.

This is pretty annoying, and i think we need to find what's responsible for this. I have the ajax response but it's never added to the dom :

<?xml version='1.0' encoding='UTF-8' standalone='yes'?><wp_ajax><response action='get-comments_0'><comments id='0' position='1'><response_data><![CDATA[<tr id='comment-1' class='comment even thread-even depth-1 approved'><td class='author column-author' data-colname="Author"><strong><img alt='' src='http://0.gravatar.com/avatar/?s=32&#038;d=mm&#038;r=g' srcset='http://2.gravatar.com/avatar/?s=64&amp;d=mm&amp;r=g 2x' class='avatar avatar-32 photo avatar-default' height='32' width='32' /> Mr WordPress</strong><br /><a href="https://wordpress.org/">wordpress.org</a><br /></td><td class='comment column-comment has-row-actions column-primary' data-colname="Comment"><div class="comment-author"><strong><img alt='' src='http://1.gravatar.com/avatar/?s=32&#038;d=mm&#038;r=g' srcset='http://1.gravatar.com/avatar/?s=64&amp;d=mm&amp;r=g 2x' class='avatar avatar-32 photo avatar-default' height='32' width='32' /> Mr WordPress</strong><br /><a href="https://wordpress.org/">wordpress.org</a><br /></div><p>Hi, this is a comment.<br />
To delete a comment, just log in and view the post&#039;s comments. There you will have the option to edit or delete them.</p>
		<div id="inline-1" class="hidden">
		<textarea class="comment" rows="1" cols="1">Hi, this is a comment.
To delete a comment, just log in and view the post&amp;#039;s comments. There you will have the option to edit or delete them.</textarea>
		<div class="author-email"></div>
		<div class="author">Mr WordPress</div>
		<div class="author-url">https://wordpress.org/</div>
		<div class="comment_status">1</div>
		</div>
		<div class="row-actions"><span class='approve'><a href='comment.php?c=1&#038;action=approvecomment&#038;_wpnonce=a29e8c6534' data-wp-lists='dim:the-comment-list:comment-1:unapproved:e7e7d3:e7e7d3:new=approved' class='vim-a' title='Approve this comment'>Approve</a></span><span class='unapprove'><a href='comment.php?c=1&#038;action=unapprovecomment&#038;_wpnonce=a29e8c6534' data-wp-lists='dim:the-comment-list:comment-1:unapproved:e7e7d3:e7e7d3:new=unapproved' class='vim-u' title='Unapprove this comment'>Unapprove</a></span><span class='reply'> | <a data-comment-id="1" data-post-id="1" data-action="replyto" class="vim-r comment-inline" title="Reply to this comment" href="#">Reply</a></span><span class='quickedit'> | <a data-comment-id="1" data-post-id="1" data-action="edit" class="vim-q comment-inline" title="Edit this item inline" href="#">Quick&nbsp;Edit</a></span><span class='edit'> | <a href='comment.php?action=editcomment&amp;c=1' title='Edit comment'>Edit</a></span><span class='spam'> | <a href='comment.php?c=1&#038;action=spamcomment&#038;_wpnonce=63693e9eb7' data-wp-lists='delete:the-comment-list:comment-1::spam=1' class='vim-s vim-destructive' title='Mark this comment as spam'>Spam</a></span><span class='trash'> | <a href='comment.php?c=1&#038;action=trashcomment&#038;_wpnonce=63693e9eb7' data-wp-lists='delete:the-comment-list:comment-1::trash=1' class='delete vim-d vim-destructive' title='Move this comment to the trash'>Trash</a></span></div><button type="button" class="toggle-row"><span class="screen-reader-text">Show more details</span></button></td></tr>
]]></response_data><supplemental></supplemental></comments></response></wp_ajax>

Am i the only one to get this weird behavior ?
Anyone has an idea what commit broke this ?

Attachments (1)

6797.patch (329 bytes) - added by imath 9 years ago.

Download all attachments as: .zip

Change History (6)

#1 @imath
9 years ago

After a few hours reverting commits, i haven't found yet.. This is a mystery!

The only thing i've figured out is: if i checkout to branch 2.4 : everything works great.

If i use master, there's a leading space before the ajax reply: whitespace<?xml...

#2 @imath
9 years ago

  • Keywords has-patch added; dev-feedback removed

I've found it!

r10417 introduced a whitespace before the opening php tag of the bp-notifications-loader.php file.

see https://buddypress.trac.wordpress.org/changeset/10417/#file141

Removing this whitespace is fixing the Ajax issue.

@imath
9 years ago

#3 @imath
9 years ago

  • Owner set to imath
  • Resolution set to fixed
  • Status changed from new to closed

In 10429:

Remove the whitespace before the first PHP opening tag in bp-notifications-loader.php

This whitespace was introduced in r10147 and was causing some damages to the comments metabox of the Post/Page WordPress edit screen: although the ajax request was getting the comments for the Post/Page, they were not displayed because of a leading whitespace.

Fixes #6797

#4 @DJPaul
9 years ago

@imath as this is a regression in 2.4, we ought to commit the fix to the 2.4 branch, too.

#5 @imath
9 years ago

@DJPaul, it's not a regression, it's something that was introduced a few days ago in trunk

There's no problem with branch 2.4, you can check it by yourself : https://buddypress.trac.wordpress.org/browser/branches/2.4/src/bp-notifications/bp-notifications-loader.php (last change is r10303)

@tw2113 committed r10417 on trunk only

Note: See TracTickets for help on using tickets.