mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/SpamBlacklist
synced 2024-12-18 01:30:42 +00:00
1814e4ee22
Bug: T307330 Depends-On: I9680cc416da5b27881aeb3502f506dcb5d4bb71f Change-Id: I80a0822b048d88c71f722e012bb250b53dce6155
27 lines
967 B
JavaScript
27 lines
967 B
JavaScript
mw.loader.using( 'ext.visualEditor.targetLoader' ).then( function () {
|
|
mw.libs.ve.targetLoader.addPlugin( function () {
|
|
|
|
ve.init.mw.SpamBlacklistSaveErrorHandler = function () {};
|
|
|
|
OO.inheritClass( ve.init.mw.SpamBlacklistSaveErrorHandler, ve.init.mw.SaveErrorHandler );
|
|
|
|
ve.init.mw.SpamBlacklistSaveErrorHandler.static.name = 'spamBlacklist';
|
|
|
|
ve.init.mw.SpamBlacklistSaveErrorHandler.static.matchFunction = function ( data ) {
|
|
return data.errors && data.errors.some( function ( err ) {
|
|
return err.code === 'spamblacklist';
|
|
} );
|
|
};
|
|
|
|
ve.init.mw.SpamBlacklistSaveErrorHandler.static.process = function ( data, target ) {
|
|
// Handle errors from Extension:SpamBlacklist
|
|
target.showSaveError( target.extractErrorMessages( data ) );
|
|
// Emit event for tracking. TODO: This is a bad design
|
|
target.emit( 'saveErrorSpamBlacklist' );
|
|
};
|
|
|
|
ve.init.mw.saveErrorHandlerFactory.register( ve.init.mw.SpamBlacklistSaveErrorHandler );
|
|
|
|
} );
|
|
} );
|