From 31ae7b3d85573edb73940e5dd8ca1ccc4c64e96f Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Tue, 5 Jul 2016 15:17:20 +0000 Subject: [PATCH] Update/Install: Correctly decrement the update count after translation updates. After [37714], an error was unnecessarily being displayed in the JavaScript console when updating translations on `wp-admin/update-core.php`. Let's not throw an error in these cases. Props afercia. Fixes #37127. git-svn-id: https://develop.svn.wordpress.org/trunk@37971 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/updates.js | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/wp-admin/js/updates.js b/src/wp-admin/js/updates.js index c3646cf840..9f05f77c88 100644 --- a/src/wp-admin/js/updates.js +++ b/src/wp-admin/js/updates.js @@ -295,20 +295,12 @@ $dashboardNavMenuUpdateCount.removeAttr( 'title' ); $dashboardNavMenuUpdateCount.find( '.update-count' ).text( count ); - switch ( type ) { - case 'plugin': - $menuItem = $( '#menu-plugins' ); - $itemCount = $menuItem.find( '.plugin-count' ); - break; - - case 'theme': - $menuItem = $( '#menu-appearance' ); - $itemCount = $menuItem.find( '.theme-count' ); - break; - - default: - window.console.error( '"%s" is not white-listed to have its count decremented.', type ); - return; + if ( 'plugin' === type ) { + $menuItem = $( '#menu-plugins' ); + $itemCount = $menuItem.find( '.plugin-count' ); + } else if ( 'theme' === type ) { + $menuItem = $( '#menu-appearance' ); + $itemCount = $menuItem.find( '.theme-count' ); } // Decrement the counter of the other menu items.