Merge "ve.init.mw.Target: Remove jqueryMsg hacks in #saveErrorNewUser"

This commit is contained in:
jenkins-bot 2015-10-06 21:09:58 +00:00 committed by Gerrit Code Review
commit 45468b992a

View file

@ -540,7 +540,7 @@ ve.init.mw.Target.prototype.saveFail = function ( doc, saveData, jqXHR, status,
target.saveErrorBadToken(); target.saveErrorBadToken();
} ) } )
.done( function ( data ) { .done( function ( data ) {
var userMsg, var
userInfo = data.query && data.query.userinfo, userInfo = data.query && data.query.userinfo,
pageInfo = data.query && data.query.pages && data.query.pageids && pageInfo = data.query && data.query.pages && data.query.pageids &&
data.query.pageids[ 0 ] && data.query.pages[ data.query.pageids[ 0 ] ], data.query.pageids[ 0 ] && data.query.pages[ data.query.pageids[ 0 ] ],
@ -573,12 +573,6 @@ ve.init.mw.Target.prototype.saveFail = function ( doc, saveData, jqXHR, status,
} else { } else {
// New session is a different user // New session is a different user
mw.config.set( { wgUserId: userInfo.id, wgUserName: userInfo.name } ); mw.config.set( { wgUserId: userInfo.id, wgUserName: userInfo.name } );
userMsg = 'visualeditor-savedialog-identify-user---' + userInfo.name;
mw.messages.set(
userMsg,
mw.messages.get( 'visualeditor-savedialog-identify-user' )
.replace( /\$1/g, userInfo.name )
);
target.saveErrorNewUser( userInfo.name ); target.saveErrorNewUser( userInfo.name );
} }
} }
@ -757,14 +751,13 @@ ve.init.mw.Target.prototype.saveErrorTitleBlacklist = function () {
ve.init.mw.Target.prototype.saveErrorNewUser = function ( username ) { ve.init.mw.Target.prototype.saveErrorNewUser = function ( username ) {
var badToken, userMsg; var badToken, userMsg;
badToken = document.createTextNode( mw.msg( 'visualeditor-savedialog-error-badtoken' ) + ' ' ); badToken = document.createTextNode( mw.msg( 'visualeditor-savedialog-error-badtoken' ) + ' ' );
// mediawiki.jqueryMsg has a bug with [[User:$1|$1]] (bug 51388)
if ( username === null ) { if ( username === null ) {
userMsg = 'visualeditor-savedialog-identify-anon'; userMsg = 'visualeditor-savedialog-identify-anon';
} else { } else {
userMsg = 'visualeditor-savedialog-identify-user---' + username; userMsg = 'visualeditor-savedialog-identify-user';
} }
this.showSaveError( this.showSaveError(
$( badToken ).add( $.parseHTML( mw.message( userMsg ).parse() ) ) $( badToken ).add( $.parseHTML( mw.message( userMsg, username ).parse() ) )
); );
this.emit( 'saveErrorNewUser' ); this.emit( 'saveErrorNewUser' );
}; };