mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TitleBlacklist
synced 2024-12-19 00:51:25 +00:00
cba4d461b9
Update matchFunction() to match the new format of responses. Remove custom error message from process(), it's worse than the default. Bug: T229532 Depends-On: I3b9c4fefc0869ef7999c21cef754434febd852ec Change-Id: Ibeae79c95557a7af699716c9d921f34c310bee6d
24 lines
909 B
JavaScript
24 lines
909 B
JavaScript
mw.libs.ve.targetLoader.addPlugin( function () {
|
|
|
|
ve.init.mw.TitleBlacklistSaveErrorHandler = function () {};
|
|
|
|
OO.inheritClass( ve.init.mw.TitleBlacklistSaveErrorHandler, ve.init.mw.SaveErrorHandler );
|
|
|
|
ve.init.mw.TitleBlacklistSaveErrorHandler.static.name = 'titleBlacklist';
|
|
|
|
ve.init.mw.TitleBlacklistSaveErrorHandler.static.matchFunction = function ( data ) {
|
|
return data.errors && data.errors.some( function ( err ) {
|
|
return err.code === 'titleblacklist-forbidden';
|
|
} );
|
|
};
|
|
|
|
ve.init.mw.TitleBlacklistSaveErrorHandler.static.process = function ( data, target ) {
|
|
// Handle warnings/errors from Extension:TitleBlacklist
|
|
target.showSaveError( target.extractErrorMessages( data ), false );
|
|
// Emit event for tracking. TODO: This is a bad design
|
|
target.emit( 'saveErrorTitleBlacklist' );
|
|
};
|
|
|
|
ve.init.mw.saveErrorHandlerFactory.register( ve.init.mw.TitleBlacklistSaveErrorHandler );
|
|
} );
|