From 34cbad3d45d95e13b9d125a638968594d9b0dd30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Thu, 1 Aug 2019 04:59:18 +0200 Subject: [PATCH] Distinguish AbuseFilter warnings and errors in VE The VE save dialog will now only display a retry button for AbuseFilter warnings, and not for errors. Bug: T211241 Change-Id: I865e8078f79e6bbcb7134b11d5f834f84bb72589 --- .../ve.init.mw.AbuseFilterSaveErrorHandler.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/ve-abusefilter/ve.init.mw.AbuseFilterSaveErrorHandler.js b/modules/ve-abusefilter/ve.init.mw.AbuseFilterSaveErrorHandler.js index 134101756..4ce60dae8 100644 --- a/modules/ve-abusefilter/ve.init.mw.AbuseFilterSaveErrorHandler.js +++ b/modules/ve-abusefilter/ve.init.mw.AbuseFilterSaveErrorHandler.js @@ -11,11 +11,11 @@ mw.libs.ve.targetLoader.addPlugin( function () { }; ve.init.mw.AbuseFilterSaveErrorHandler.static.process = function ( data, target ) { + var + $message = $( $.parseHTML( ve.getProp( data, 'visualeditoredit', 'edit', 'warning' ) ) ), + isWarning = ve.getProp( data, 'visualeditoredit', 'edit', 'code' ) !== 'abusefilter-disallowed'; // Handle warnings/errors from Extension:AbuseFilter - target.showSaveError( $( $.parseHTML( ve.getProp( data, 'visualeditoredit', 'edit', 'warning' ) ) ) ); - // Don't disable the save button. If the action is not disallowed the user may save the - // edit by pressing Save again. The AbuseFilter API currently has no way to distinguish - // between filter triggers that are and aren't disallowing the action. + target.showSaveError( $message, isWarning, isWarning ); // Emit event for tracking. TODO: This is a bad design target.emit( 'saveErrorAbuseFilter' ); };