mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Stop an incorrect comment total being displayed when a trashed/spammed comment is deleted or restored. Fixes #19029.
Also only run getUpdate() when necessary and remove reference to non-existent "span.total-type-count". git-svn-id: http://svn.automattic.com/wordpress/trunk@19068 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
673a69be75
commit
7ba5b2f7a3
@ -103,7 +103,7 @@ setCommentsList = function() {
|
||||
return settings;
|
||||
};
|
||||
|
||||
// Updates the current total (as displayed visibly)
|
||||
// Updates the current total (stored in the _total input)
|
||||
updateTotalCount = function( total, time, setConfidentTime ) {
|
||||
if ( time < lastConfidentTime )
|
||||
return;
|
||||
@ -112,9 +112,6 @@ setCommentsList = function() {
|
||||
lastConfidentTime = time;
|
||||
|
||||
totalInput.val( total.toString() );
|
||||
$('span.total-type-count').each( function() {
|
||||
updateCount( $(this), total );
|
||||
});
|
||||
};
|
||||
|
||||
dashboardTotals = function(n) {
|
||||
@ -172,8 +169,9 @@ setCommentsList = function() {
|
||||
|
||||
// In admin-ajax.php, we send back the unix time stamp instead of 1 on success
|
||||
delAfter = function( r, settings ) {
|
||||
var total, N, untrash = $(settings.target).parent().is('span.untrash'),
|
||||
unspam = $(settings.target).parent().is('span.unspam'), spam, trash, pending,
|
||||
var total, N, spam, trash, pending,
|
||||
untrash = $(settings.target).parent().is('span.untrash'),
|
||||
unspam = $(settings.target).parent().is('span.unspam'),
|
||||
unapproved = $('#' + settings.element).is('.unapproved');
|
||||
|
||||
function getUpdate(s) {
|
||||
@ -185,13 +183,15 @@ setCommentsList = function() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
spam = getUpdate('spam');
|
||||
trash = getUpdate('trash');
|
||||
|
||||
if ( untrash )
|
||||
trash = -1;
|
||||
else
|
||||
trash = getUpdate('trash');
|
||||
|
||||
if ( unspam )
|
||||
spam = -1;
|
||||
else
|
||||
spam = getUpdate('spam');
|
||||
|
||||
pending = getCount( $('span.pending-count').eq(0) );
|
||||
|
||||
@ -218,7 +218,11 @@ setCommentsList = function() {
|
||||
dashboardTotals(N);
|
||||
} else {
|
||||
total = totalInput.val() ? parseInt( totalInput.val(), 10 ) : 0;
|
||||
total = total - spam - trash;
|
||||
if ( $(settings.target).parent().is('span.undo') )
|
||||
total++;
|
||||
else
|
||||
total--;
|
||||
|
||||
if ( total < 0 )
|
||||
total = 0;
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -295,7 +295,7 @@ function wp_default_scripts( &$scripts ) {
|
||||
|
||||
$scripts->add( 'admin-custom-fields', "/wp-admin/js/custom-fields$suffix.js", array('wp-lists'), '20110429', 1 );
|
||||
|
||||
$scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'quicktags', 'jquery-query'), '20110928', 1 );
|
||||
$scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'quicktags', 'jquery-query'), '20111026', 1 );
|
||||
$scripts->add_script_data( 'admin-comments', 'adminCommentsL10n', array(
|
||||
'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
|
||||
'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last']),
|
||||
|
Loading…
Reference in New Issue
Block a user