Fix Reply and Approve when replying from the comment moderation page, see #15898

git-svn-id: http://svn.automattic.com/wordpress/trunk@17983 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2011-05-21 17:11:13 +00:00
parent 98bd4c0b2f
commit 7815408b7a
3 changed files with 24 additions and 19 deletions

View File

@ -452,7 +452,7 @@ commentReply = {
$('#replysubmit .error').hide(); $('#replysubmit .error').hide();
$('#replysubmit .waiting').show(); $('#replysubmit .waiting').show();
$('#replyrow input').each(function() { $('#replyrow input').not(':button').each(function() {
post[ $(this).attr('name') ] = $(this).val(); post[ $(this).attr('name') ] = $(this).val();
}); });
@ -478,6 +478,8 @@ commentReply = {
show : function(xml) { show : function(xml) {
var t = this, r, c, id, bg, pid; var t = this, r, c, id, bg, pid;
t.revert();
if ( typeof(xml) == 'string' ) { if ( typeof(xml) == 'string' ) {
t.error({'responseText': xml}); t.error({'responseText': xml});
return false; return false;
@ -495,28 +497,31 @@ commentReply = {
if ( 'edit-comment' == t.act ) if ( 'edit-comment' == t.act )
$(id).remove(); $(id).remove();
$(c).hide()
$('#replyrow').after(c);
if ( r.supplemental.parent_approved ) { if ( r.supplemental.parent_approved ) {
pid = '#comment-' + r.supplemental.parent_approved; pid = $('#comment-' + r.supplemental.parent_approved);
updatePending( getCount( $('span.pending-count').eq(0) ) - 1 ); updatePending( getCount( $('span.pending-count').eq(0) ) - 1 );
if ( this.comments_listing == 'moderated' ) {
pid.animate( { 'backgroundColor':'#CCEEBB' }, 400, function(){
pid.fadeOut();
});
return;
}
} }
t.revert(); $(c).hide()
t.addEvents($(id)); $('#replyrow').after(c);
bg = $(id).hasClass('unapproved') ? '#FFFFE0' : '#FFFFFF'; id = $(id);
t.addEvents(id);
bg = id.css('background-color');
$(id) id.animate( { 'backgroundColor':'#CCEEBB' }, 300 )
.animate( { 'backgroundColor':'#CCEEBB' }, 300 )
.animate( { 'backgroundColor': bg }, 300, function() { .animate( { 'backgroundColor': bg }, 300, function() {
if ( pid ) { if ( pid && pid.length ) {
pid = $(pid) pid.animate( { 'backgroundColor':'#CCEEBB' }, 300 )
.animate( { 'backgroundColor':'#CCEEBB' }, 300 ) .animate( { 'backgroundColor': bg }, 300 )
.animate( { 'backgroundColor': '#FFFFFF' }, 300 ) .removeClass('unapproved').addClass('approved')
.removeClass('unapproved').addClass('approved'); .find('div.comment_status').html('1');
pid.find('div.comment_status').html('1');
} }
}); });

File diff suppressed because one or more lines are too long

View File

@ -312,7 +312,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'admin-custom-fields', "/wp-admin/js/custom-fields$suffix.js", array('wp-lists'), '20110429' ); $scripts->add( 'admin-custom-fields', "/wp-admin/js/custom-fields$suffix.js", array('wp-lists'), '20110429' );
$scripts->add_data( 'admin-custom-fields', 'group', 1 ); $scripts->add_data( 'admin-custom-fields', 'group', 1 );
$scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags', 'jquery-query'), '20110518' ); $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'jquery-ui-resizable', 'quicktags', 'jquery-query'), '20110521' );
$scripts->add_data( 'admin-comments', 'group', 1 ); $scripts->add_data( 'admin-comments', 'group', 1 );
$scripts->localize( 'admin-comments', 'adminCommentsL10n', array( $scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']), 'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),