mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-27 23:40:19 +00:00
Require tags to be valid page titles. In the message, gives general recommendations that they be short and simple, rather than specifying the exact criteria. I want to encourage simplicity in tags, rather than fixing an immediate problem
This commit is contained in:
parent
d69a31acb3
commit
94a9b2b174
|
@ -216,6 +216,8 @@ Please ask a user with permission to add restricted actions to make the change f
|
|||
'abusefilter-edit-export' => 'Export this filter to another wiki',
|
||||
'abusefilter-edit-syntaxok' => 'No syntax errors detected.',
|
||||
'abusefilter-edit-syntaxerr' => 'Syntax error detected: $1',
|
||||
'abusefilter-edit-bad-tags' => 'One or more of the tags you specified is not valid.
|
||||
Tags should be short, and they should not contain special characters.',
|
||||
|
||||
// Filter editing helpers
|
||||
'abusefilter-edit-builder-select' => 'Select an option to add it at the cursor',
|
||||
|
|
|
@ -73,6 +73,26 @@ class AbuseFilterViewEdit extends AbuseFilterView {
|
|||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// If we've activated the 'tag' option, check the arguments for validity.
|
||||
if ( !empty($actions['tag']) ) {
|
||||
$bad = false;
|
||||
foreach( $actions['tag']['parameters'] as $tag ) {
|
||||
$t = Title::makeTitleSafe( NS_MEDIAWIKI, 'tag-'.$tag );
|
||||
if (!$t) {
|
||||
$bad = true;
|
||||
}
|
||||
|
||||
if ($bad) {
|
||||
$wgOut->addHTML( $this->buildFilterEditor(
|
||||
wfMsgExt( 'abusefilter-edit-bad-tags', 'parse' ),
|
||||
$this->mFilter,
|
||||
$history_id
|
||||
) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$newRow = get_object_vars($newRow); // Convert from object to array
|
||||
|
||||
|
|
Loading…
Reference in a new issue