From 85128c9da61e2c4deef749ce1eab75b3d2d43e94 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Tue, 25 Nov 2008 02:41:54 +0000 Subject: [PATCH] Fix QE and Reply actions on comments that come in via infinite comment stream git-svn-id: https://develop.svn.wordpress.org/trunk@9868 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/admin-ajax.php | 2 +- wp-admin/includes/template.php | 6 +++--- wp-admin/js/edit-comments.js | 3 --- wp-includes/script-loader.php | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index 123419fd38..94351871f1 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -465,7 +465,7 @@ case 'add-comment' : foreach ( (array) $comments as $comment ) { get_comment( $comment ); ob_start(); - _wp_comment_row( $comment->comment_ID, $mode, $status ); + _wp_comment_row( $comment->comment_ID, $mode, $status, true, true ); $comment_list_item = ob_get_contents(); ob_end_clean(); $x->add( array( diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 596ad94299..049a170ade 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -1917,7 +1917,7 @@ function _wp_get_comment_list( $status = '', $s = false, $start, $num, $post = 0 * @param unknown_type $comment_status * @param unknown_type $checkbox */ -function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true ) { +function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true, $from_ajax = false ) { global $comment, $post; $comment = get_comment( $comment_id ); $post = get_post($comment->comment_post_ID); @@ -2007,8 +2007,8 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true ++$i; ( ( ('approve' == $action || 'unapprove' == $action) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | '; - // Reply and quickedit need a hide-if-no-js span - if ( 'reply' == $action || 'quickedit' == $action ) + // Reply and quickedit need a hide-if-no-js span when not added with ajax + if ( ('reply' == $action || 'quickedit' == $action) && ! $from_ajax ) $action .= ' hide-if-no-js'; echo "$sep$link"; diff --git a/wp-admin/js/edit-comments.js b/wp-admin/js/edit-comments.js index 3615035b96..36fc82abcc 100644 --- a/wp-admin/js/edit-comments.js +++ b/wp-admin/js/edit-comments.js @@ -81,9 +81,6 @@ $(document).ready(function(){ commentReply = { init : function() { - this.rows = $('#the-comment-list tr'); - if ( !this.rows.size() ) - this.rows = $('#the-comment-list > div.comment-item'); var row = $('#replyrow'); $('a.cancel', row).click(function() { return commentReply.revert(); }); diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 2b107652c5..a34c28e9ce 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -156,7 +156,7 @@ function wp_default_scripts( &$scripts ) { 'good' => _c('Medium|password strength'), 'strong' => __('Strong') ) ); - $scripts->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20081117' ); + $scripts->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20081124' ); $scripts->localize( 'admin-comments', 'adminCommentsL10n', array( 'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']), 'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last'])