mediawiki.special.upload.js: Remove spinner in .always() instead of .done()
[lhc/web/wiklou.git] / resources / src / mediawiki.special / mediawiki.special.upload.js
index 7693340..945bfb0 100644 (file)
@@ -74,8 +74,9 @@
                                if ( result.query ) {
                                        resultOut = result.query.pages[ result.query.pageids[ 0 ] ].imageinfo[ 0 ];
                                }
-                               $spinnerDestCheck.remove();
                                uploadWarning.processResult( resultOut, uploadWarning.nameToCheck );
+                       } ).always( function () {
+                               $spinnerDestCheck.remove();
                        } );
                },
 
@@ -85,7 +86,9 @@
                },
 
                setWarning: function ( warning ) {
-                       $( '#wpDestFile-warning' ).html( warning );
+                       var $warning = $( $.parseHTML( warning ) );
+                       mw.hook( 'wikipage.content' ).fire( $warning );
+                       $( '#wpDestFile-warning' ).empty().append( $warning );
 
                        // Set a value in the form indicating that the warning is acknowledged and
                        // doesn't need to be redisplayed post-upload
                                prop: 'text',
                                pst: true
                        } ).done( function ( result ) {
-                               $spinnerLicense.remove();
                                uploadLicense.processResult( result, license );
+                       } ).always( function () {
+                               $spinnerLicense.remove();
                        } );
                },
 
                        var reader = new FileReader();
                        if ( callbackBinary && 'readAsBinaryString' in reader ) {
                                // To fetch JPEG metadata we need a binary string; start there.
-                               // todo:
+                               // TODO
                                reader.onload = function () {
                                        callbackBinary( reader.result );