Werdna has uploaded a new change for review.
https://gerrit.wikimedia.org/r/80137
Change subject: Bring API error messages for AbuseFilter in line with standard
API errors
......................................................................
Bring API error messages for AbuseFilter in line with standard API errors
Change-Id: Ie5946e1c88fce5cf8d0d4e8c01f1a7d508876525
---
M AbuseFilter.hooks.php
M AbuseFilter.i18n.php
2 files changed, 12 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AbuseFilter
refs/changes/37/80137/1
diff --git a/AbuseFilter.hooks.php b/AbuseFilter.hooks.php
index 0f1fe9a..39874d5 100644
--- a/AbuseFilter.hooks.php
+++ b/AbuseFilter.hooks.php
@@ -49,11 +49,18 @@
$warning = wfMessage( $code )->params( $msg
)->parse();
}
- $result = array(
- 'code' => $code,
- 'info' => 'Hit AbuseFilter: ' .
$filterDescription,
+ $extraData = array(
+ 'error-msg' => $code,
+ 'filter-description' => $filterDescription,
'warning' => $warning
);
+
+ throw new UsageException(
+ wfMessage( 'abusefilter-api-disallowed',
$filterDescription )->plain(),
+ 'abusefilter-aborted',
+ 0,
+ $extraData
+ );
}
return $status->isOK();
diff --git a/AbuseFilter.i18n.php b/AbuseFilter.i18n.php
index 8783627..c7c3f44 100644
--- a/AbuseFilter.i18n.php
+++ b/AbuseFilter.i18n.php
@@ -44,6 +44,7 @@
'abusefilter-autopromote-blocked' => "This action has been
automatically identified as harmful, and it has been disallowed.
In addition, as a security measure, some privileges routinely granted to
established accounts have been temporarily revoked from your account.
A brief description of the abuse rule which your action matched is: $1",
+ 'abusefilter-api-disallowed' => 'Action disallowed by an automatic edit
filter. The filter\'s description is: $1',
'abusefilter-blocker' => 'Abuse filter',
'abusefilter-blockreason' => 'Automatically blocked by abuse filter.
@@ -1060,6 +1061,7 @@
'abusefilter-import-intro' => "Do not ''translate''
<nowiki>{{int:abusefilter-edit-export}}</nowiki>,
<nowiki>{{int:abusefilter-tools-subtitle}}</nowiki>, and
<nowiki>{{int:abusefilter-import-submit}}</nowiki> unless you absolute must
substitute any of them.",
'abusefilter-group-default' => 'The name for the default filter group.
Most filters will be in this group.
{{Identical|Default}}',
+ 'abusefilted-api-disallowed' => 'Error message returned by the API when
the Abuse Filter disallows an edit',
);
/** Achinese (Acèh)
--
To view, visit https://gerrit.wikimedia.org/r/80137
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie5946e1c88fce5cf8d0d4e8c01f1a7d508876525
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/AbuseFilter
Gerrit-Branch: master
Gerrit-Owner: Werdna <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits