Don't show form for reverting filter actions when no actions were found

Change-Id: I779a318a9daaf6d3a17335914a7fd85877765625
This commit is contained in:
Matěj Suchánek 2020-11-10 10:45:24 +01:00 committed by Jforrester
parent 725ec052ed
commit 8955c55dc7
3 changed files with 9 additions and 3 deletions

View file

@ -474,6 +474,7 @@
"abusefilter-revert-periodend": "Period end:",
"abusefilter-revert-search": "Select actions",
"abusefilter-revert-filter": "Filter ID:",
"abusefilter-revert-preview-no-results": "The query did not find any actions that could be reverted.",
"abusefilter-revert-preview-intro": "Below are the actions taken by the abuse filter that will be reverted by this action.\nPlease check them carefully, and click \"{{int:abusefilter-revert-confirm}}\" to confirm your selection.",
"abusefilter-revert-confirm-legend": "Confirm the revert",
"abusefilter-revert-confirm": "Confirm",

View file

@ -512,6 +512,7 @@
"abusefilter-revert-periodend": "Used as label on [[Special:AbuseFilter/revert]]",
"abusefilter-revert-search": "Used as label on [[Special:AbuseFilter/revert]]",
"abusefilter-revert-filter": "{{Identical|Filter ID}}",
"abusefilter-revert-preview-no-results": "Shown on [[Special:AbuseFilter/revert]] when the query for filter actions to be reverted returned no results.",
"abusefilter-revert-preview-intro": "Refers to {{msg-mw|Abusefilter-revert-confirm}}.",
"abusefilter-revert-confirm-legend": "Form fieldset for [[Special:AbuseFilter/revert]] asking the user to confirm the revert. Refers to {{msg-mw|Abusefilter-revert-confirm}}.",
"abusefilter-revert-confirm": "This is also used in {{msg-mw|Abusefilter-revert-preview-intro}}. When changing this message, please also remember to change that one.\n{{Identical|Confirm}}",

View file

@ -112,11 +112,15 @@ class AbuseFilterViewRevert extends AbuseFilterView {
$user = $this->getUser();
$filter = $this->filter;
// Add a summary of everything that will be reversed.
$dateForm->addPostText( $this->msg( 'abusefilter-revert-preview-intro' )->parseAsBlock() );
// Look up all of them.
$results = $this->doLookup();
if ( $results === [] ) {
$dateForm->addPostText( $this->msg( 'abusefilter-revert-preview-no-results' )->escaped() );
return true;
}
// Add a summary of everything that will be reversed.
$dateForm->addPostText( $this->msg( 'abusefilter-revert-preview-intro' )->parseAsBlock() );
$list = [];
$context = $this->getContext();