2020-06-30 15:20:50 +00:00
|
|
|
mw.loader.using( 'ext.visualEditor.targetLoader' ).then( function () {
|
|
|
|
mw.libs.ve.targetLoader.addPlugin( function () {
|
2018-11-29 17:10:39 +00:00
|
|
|
|
2020-06-30 15:20:50 +00:00
|
|
|
ve.init.mw.SpamBlacklistSaveErrorHandler = function () {};
|
2018-11-29 17:10:39 +00:00
|
|
|
|
2020-06-30 15:20:50 +00:00
|
|
|
OO.inheritClass( ve.init.mw.SpamBlacklistSaveErrorHandler, ve.init.mw.SaveErrorHandler );
|
2018-11-29 17:10:39 +00:00
|
|
|
|
2020-06-30 15:20:50 +00:00
|
|
|
ve.init.mw.SpamBlacklistSaveErrorHandler.static.name = 'spamBlacklist';
|
2018-11-29 17:10:39 +00:00
|
|
|
|
2020-06-30 15:20:50 +00:00
|
|
|
ve.init.mw.SpamBlacklistSaveErrorHandler.static.matchFunction = function ( data ) {
|
|
|
|
return data.errors && data.errors.some( function ( err ) {
|
|
|
|
return err.code === 'spamblacklist';
|
|
|
|
} );
|
|
|
|
};
|
2018-11-29 17:10:39 +00:00
|
|
|
|
2020-06-30 15:20:50 +00:00
|
|
|
ve.init.mw.SpamBlacklistSaveErrorHandler.static.process = function ( data, target ) {
|
|
|
|
// Handle spam blacklist error from Extension:SpamBlacklist
|
|
|
|
target.showSaveError(
|
|
|
|
target.extractErrorMessages( data ),
|
|
|
|
false // prevents reapply
|
|
|
|
);
|
|
|
|
// Emit event for tracking. TODO: This is a bad design
|
|
|
|
target.emit( 'saveErrorSpamBlacklist' );
|
|
|
|
};
|
2018-11-29 17:10:39 +00:00
|
|
|
|
2020-06-30 15:20:50 +00:00
|
|
|
ve.init.mw.saveErrorHandlerFactory.register( ve.init.mw.SpamBlacklistSaveErrorHandler );
|
2018-11-29 17:10:39 +00:00
|
|
|
|
2020-06-30 15:20:50 +00:00
|
|
|
} );
|
2018-11-29 17:10:39 +00:00
|
|
|
} );
|