mw.Upload.BookletLayout: Use 'amenableparser' to handle templates in error messages
authorBartosz Dziewoński <matma.rex@gmail.com>
Tue, 30 Aug 2016 16:49:27 +0000 (18:49 +0200)
committerBartosz Dziewoński <matma.rex@gmail.com>
Tue, 30 Aug 2016 16:49:27 +0000 (18:49 +0200)
Depends-On: I7e1a52a59a25befe4edb7b4f531d60a2615e8f90
Bug: T144237
Change-Id: I022e1f178c5a10c440f7fddc73709a4e262c5801

resources/src/mediawiki/mediawiki.Upload.BookletLayout.js

index 31e4492..920835f 100644 (file)
                        if ( error.message ) {
                                return this.upload.getApi()
                                        .then( function ( api ) {
-                                               return api.loadMessagesIfMissing( [ error.message.key ] ).then( function () {
-                                                       if ( !mw.message( error.message.key ).exists() ) {
-                                                               return $.Deferred().reject();
-                                                       }
-                                                       return new OO.ui.Error(
-                                                               $( '<p>' ).msg( error.message.key, error.message.params || [] ),
-                                                               { recoverable: false }
-                                                       );
-                                               } );
+                                               // 'amenableparser' will expand templates and parser functions server-side.
+                                               // We still do the rest of wikitext parsing here (throught jqueryMsg).
+                                               return api.loadMessagesIfMissing( [ error.message.key ], { amenableparser: true } )
+                                                       .then( function () {
+                                                               if ( !mw.message( error.message.key ).exists() ) {
+                                                                       return $.Deferred().reject();
+                                                               }
+                                                               return new OO.ui.Error(
+                                                                       $( '<p>' ).msg( error.message.key, error.message.params || [] ),
+                                                                       { recoverable: false }
+                                                               );
+                                                       } );
                                        } )
                                        .then( null, function () {
                                                // We failed when loading the error message, or it doesn't actually exist, fall back