From a5253fd686d4941be39d8399d6099ab741852a7c Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Wed, 28 Nov 2012 22:27:13 +0000 Subject: [PATCH] Media modal: Don't fire two AJAX calls on settings update. Props koopersmith fixes #22611 git-svn-id: http://core.svn.wordpress.org/trunk@22907 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/js/media-views.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/wp-includes/js/media-views.js b/wp-includes/js/media-views.js index 9b00de912f..e694c476c7 100644 --- a/wp-includes/js/media-views.js +++ b/wp-includes/js/media-views.js @@ -2574,12 +2574,17 @@ }, updateSetting: function( event ) { - var $setting = $( event.target ).closest('[data-setting]'); + var $setting = $( event.target ).closest('[data-setting]'), + setting, value; if ( ! $setting.length ) return; - this.model.save( $setting.data('setting'), event.target.value ); + setting = $setting.data('setting'); + value = event.target.value; + + if ( this.model.get( setting ) !== value ) + this.model.save( setting, value ); }, updateAll: function() {