2018-11-29 17:10:39 +00:00
|
|
|
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';
|
|
|
|
|
2018-12-07 19:17:55 +00:00
|
|
|
ve.init.mw.SpamBlacklistSaveErrorHandler.static.matchFunction = function ( data ) {
|
|
|
|
return !!ve.getProp( data, 'visualeditoredit', 'edit', 'spamblacklist' );
|
2018-11-29 17:10:39 +00:00
|
|
|
};
|
|
|
|
|
2018-12-07 19:17:55 +00:00
|
|
|
ve.init.mw.SpamBlacklistSaveErrorHandler.static.process = function ( data, target ) {
|
2018-11-29 17:10:39 +00:00
|
|
|
// Handle spam blacklist error from Extension:SpamBlacklist
|
|
|
|
target.showSaveError(
|
2018-12-07 19:17:55 +00:00
|
|
|
$( $.parseHTML( ve.getProp( data, 'visualeditoredit', 'edit', 'sberrorparsed' ) ) ),
|
2018-11-29 17:10:39 +00:00
|
|
|
false // prevents reapply
|
|
|
|
);
|
|
|
|
// Emit event for tracking. TODO: This is a bad design
|
|
|
|
target.emit( 'saveErrorSpamBlacklist' );
|
|
|
|
};
|
|
|
|
|
|
|
|
ve.init.mw.saveErrorHandlerFactory.register( ve.init.mw.SpamBlacklistSaveErrorHandler );
|
|
|
|
|
|
|
|
} );
|