From 6f761b1ef33e01700852917ed0660ab2fff62772 Mon Sep 17 00:00:00 2001 From: ryan Date: Sun, 4 Nov 2007 06:23:03 +0000 Subject: [PATCH] Update awaiting moderation count when comments are moderated through AJAX. Props mdawaffe. fixes #5315 git-svn-id: http://svn.automattic.com/wordpress/trunk@6312 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/js/edit-comments.js | 8 +++++--- wp-includes/script-loader.php | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/wp-admin/js/edit-comments.js b/wp-admin/js/edit-comments.js index a185774f21..e37d3fb73c 100644 --- a/wp-admin/js/edit-comments.js +++ b/wp-admin/js/edit-comments.js @@ -3,13 +3,15 @@ jQuery(function($) { var dimAfter = function( r, settings ) { var a = $('#awaitmod'); - a.html( parseInt(a.html(),10) + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 ) ); + var n = parseInt(a.html(),10) + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 ); + a.html( n.toString() ); } var delAfter = function( r, settings ) { var a = $('#awaitmod'); - if ( $('#' + settings.element).is('.unapproved') && parseInt(a.html(),10) > 0 ) { - a.html( parseInt(a.html(),10) - 1 ); + if ( a.parent('.current').size() || $('#' + settings.element).is('.unapproved') && parseInt(a.html(),10) > 0 ) { + var n = parseInt(a.html(),10) - 1; + a.html( n.toString() ); } if ( extra.size() == 0 || extra.children().size() == 0 ) { diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 06cb2c9d2f..3dfce01a15 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -117,7 +117,7 @@ class WP_Scripts { ) ); $this->add( 'admin-categories', '/wp-admin/js/categories.js', array('wp-lists'), '20071031' ); $this->add( 'admin-custom-fields', '/wp-admin/js/custom-fields.js', array('wp-lists'), '20070823' ); - $this->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists'), '20070822' ); + $this->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists'), '20071104' ); $this->add( 'admin-posts', '/wp-admin/js/edit-posts.js', array('wp-lists'), '20071023' ); $this->add( 'admin-users', '/wp-admin/js/users.js', array('wp-lists'), '20070823' ); $this->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' );