Merge "mediawiki.Upload.BookletLayout: Handle errors from TitleBlacklist (HACK)"
[lhc/web/wiklou.git] / resources / src / mediawiki / mediawiki.Upload.BookletLayout.js
index 496904f..7b307ee 100644 (file)
                        warnings = stateDetails.upload && stateDetails.upload.warnings;
 
                if ( state === mw.Upload.State.ERROR ) {
+                       // HACK We should either have a hook here to allow TitleBlacklist to handle this, or just have
+                       // TitleBlacklist produce sane error messages that can be displayed without arcane knowledge
+                       if ( error.info === 'TitleBlacklist prevents this title from being created' ) {
+                               // HACK Apparently the only reliable way to determine whether TitleBlacklist was involved
+                               return new OO.ui.Error(
+                                       $( '<p>' ).html(
+                                               // HACK TitleBlacklist doesn't have a sensible message, this one is from UploadWizard
+                                               mw.message( 'api-error-blacklisted' ).parse()
+                                       ),
+                                       { recoverable: false }
+                               );
+                       }
+
                        message = mw.message( 'api-error-' + error.code );
                        if ( !message.exists() ) {
                                message = mw.message( 'api-error-unknownerror', JSON.stringify( stateDetails ) );