mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-23 21:53:35 +00:00
Merge "Add an option to hide private filters on Special:AbuseFilter"
This commit is contained in:
commit
1981c9f8b8
|
@ -133,7 +133,9 @@
|
|||
"abusefilter-list-options-scope-global": "Global rules only",
|
||||
"abusefilter-list-options-scope-all": "Local and global rules",
|
||||
"abusefilter-list-options-disabled": "Disabled filters:",
|
||||
"abusefilter-list-options-private": "Private filters:",
|
||||
"abusefilter-list-options-hidedisabled": "Hide disabled filters",
|
||||
"abusefilter-list-options-hideprivate": "Hide private filters",
|
||||
"abusefilter-list-options-searchfield": "Search within rules:",
|
||||
"abusefilter-list-options-searchpattern": "Insert a pattern",
|
||||
"abusefilter-list-options-searchoptions": "Search mode:",
|
||||
|
|
|
@ -166,7 +166,9 @@
|
|||
"abusefilter-list-options-scope-global": "Radio button indicating that global rules should be shown",
|
||||
"abusefilter-list-options-scope-all": "Radio button indicating that local and global rules should be shown",
|
||||
"abusefilter-list-options-disabled": "Field label in filter form.",
|
||||
"abusefilter-list-options-hidedisabled": "Radio button label in filter form.",
|
||||
"abusefilter-list-options-private": "Field label in filter form.",
|
||||
"abusefilter-list-options-hidedisabled": "Checkbox label in filter form.",
|
||||
"abusefilter-list-options-hideprivate": "Checkbox label in filter form.",
|
||||
"abusefilter-list-options-searchfield": "Field label in filter form.",
|
||||
"abusefilter-list-options-searchpattern": "Text input for search pattern",
|
||||
"abusefilter-list-options-searchoptions": "Field label in filter form.",
|
||||
|
|
|
@ -31,6 +31,7 @@ class AbuseFilterViewList extends AbuseFilterView {
|
|||
$conds = [];
|
||||
$deleted = $request->getVal( 'deletedfilters' );
|
||||
$hidedisabled = $request->getBool( 'hidedisabled' );
|
||||
$hideprivate = $request->getBool( 'hideprivate' );
|
||||
$defaultscope = 'all';
|
||||
if ( $config->get( 'AbuseFilterCentralDB' ) !== null
|
||||
&& !$config->get( 'AbuseFilterIsCentral' ) ) {
|
||||
|
@ -62,6 +63,9 @@ class AbuseFilterViewList extends AbuseFilterView {
|
|||
$conds['af_deleted'] = 0;
|
||||
$conds['af_enabled'] = 1;
|
||||
}
|
||||
if ( $hideprivate ) {
|
||||
$conds['af_hidden'] = 0;
|
||||
}
|
||||
|
||||
if ( $scope == 'local' ) {
|
||||
$conds['af_global'] = 0;
|
||||
|
@ -88,7 +92,15 @@ class AbuseFilterViewList extends AbuseFilterView {
|
|||
);
|
||||
$this->showList(
|
||||
[ 'af_deleted' => 0 ],
|
||||
compact( 'deleted', 'hidedisabled', 'querypattern', 'searchmode', 'scope', 'searchEnabled' )
|
||||
compact(
|
||||
'deleted',
|
||||
'hidedisabled',
|
||||
'hideprivate',
|
||||
'querypattern',
|
||||
'searchmode',
|
||||
'scope',
|
||||
'searchEnabled'
|
||||
)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
@ -112,7 +124,15 @@ class AbuseFilterViewList extends AbuseFilterView {
|
|||
|
||||
$this->showList(
|
||||
$conds,
|
||||
compact( 'deleted', 'hidedisabled', 'querypattern', 'searchmode', 'scope', 'searchEnabled' )
|
||||
compact(
|
||||
'deleted',
|
||||
'hidedisabled',
|
||||
'hideprivate',
|
||||
'querypattern',
|
||||
'searchmode',
|
||||
'scope',
|
||||
'searchEnabled'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -128,6 +148,7 @@ class AbuseFilterViewList extends AbuseFilterView {
|
|||
|
||||
$deleted = $optarray['deleted'];
|
||||
$hidedisabled = $optarray['hidedisabled'];
|
||||
$hideprivate = $optarray['hideprivate'];
|
||||
$scope = $optarray['scope'];
|
||||
|
||||
$searchEnabled = $optarray['searchEnabled'];
|
||||
|
@ -193,7 +214,7 @@ class AbuseFilterViewList extends AbuseFilterView {
|
|||
];
|
||||
}
|
||||
|
||||
$formDescriptor['info'] = [
|
||||
$formDescriptor['infodisabled'] = [
|
||||
'type' => 'info',
|
||||
'default' => $this->msg( 'abusefilter-list-options-disabled' )->parse(),
|
||||
];
|
||||
|
@ -205,6 +226,18 @@ class AbuseFilterViewList extends AbuseFilterView {
|
|||
'selected' => $hidedisabled,
|
||||
];
|
||||
|
||||
$formDescriptor['infoprivate'] = [
|
||||
'type' => 'info',
|
||||
'default' => $this->msg( 'abusefilter-list-options-private' )->parse(),
|
||||
];
|
||||
|
||||
$formDescriptor['hideprivate'] = [
|
||||
'name' => 'hideprivate',
|
||||
'type' => 'check',
|
||||
'label-message' => 'abusefilter-list-options-hideprivate',
|
||||
'selected' => $hideprivate,
|
||||
];
|
||||
|
||||
// ToDo: Since this is only for saving space, we should convert it
|
||||
// to use a 'hide-if'
|
||||
if ( $searchEnabled ) {
|
||||
|
|
Loading…
Reference in a new issue