2020-06-30 15:35:27 +00:00
|
|
|
mw.loader.using( 'ext.visualEditor.targetLoader' ).then( function () {
|
|
|
|
mw.libs.ve.targetLoader.addPlugin( function () {
|
2018-12-06 18:27:04 +00:00
|
|
|
|
2020-06-30 15:35:27 +00:00
|
|
|
ve.init.mw.TitleBlacklistSaveErrorHandler = function () {};
|
2018-12-06 18:27:04 +00:00
|
|
|
|
2020-06-30 15:35:27 +00:00
|
|
|
OO.inheritClass( ve.init.mw.TitleBlacklistSaveErrorHandler, ve.init.mw.SaveErrorHandler );
|
2018-12-06 18:27:04 +00:00
|
|
|
|
2020-06-30 15:35:27 +00:00
|
|
|
ve.init.mw.TitleBlacklistSaveErrorHandler.static.name = 'titleBlacklist';
|
2018-12-06 18:27:04 +00:00
|
|
|
|
2020-06-30 15:35:27 +00:00
|
|
|
ve.init.mw.TitleBlacklistSaveErrorHandler.static.matchFunction = function ( data ) {
|
|
|
|
return data.errors && data.errors.some( function ( err ) {
|
|
|
|
return err.code === 'titleblacklist-forbidden';
|
|
|
|
} );
|
|
|
|
};
|
2018-12-06 18:27:04 +00:00
|
|
|
|
2020-06-30 15:35:27 +00:00
|
|
|
ve.init.mw.TitleBlacklistSaveErrorHandler.static.process = function ( data, target ) {
|
2022-07-19 19:40:16 +00:00
|
|
|
// Handle errors from Extension:TitleBlacklist
|
|
|
|
target.showSaveError( target.extractErrorMessages( data ) );
|
2020-06-30 15:35:27 +00:00
|
|
|
// Emit event for tracking. TODO: This is a bad design
|
|
|
|
target.emit( 'saveErrorTitleBlacklist' );
|
|
|
|
};
|
2018-12-06 18:27:04 +00:00
|
|
|
|
2020-06-30 15:35:27 +00:00
|
|
|
ve.init.mw.saveErrorHandlerFactory.register( ve.init.mw.TitleBlacklistSaveErrorHandler );
|
|
|
|
} );
|
2018-12-06 18:27:04 +00:00
|
|
|
} );
|