Fix the Linter category subpage search when namespace field is blank

* When the user does not specify any namespace in a category
  subpage search it should return all namespaces. This duplicates
  the behavior for when the category is first selected from the
  main Linter page.

Bug: T361081
Change-Id: Iccb195bf1b679e6e0165e4b1dde6e8d84db4d5b0
This commit is contained in:
sbailey 2024-06-10 11:15:33 -07:00
parent 186c54d1dc
commit 85ea579c97

View file

@ -210,10 +210,12 @@ class SpecialLintErrors extends SpecialPage {
);
if ( $request->getCheck( 'wpNamespaceRestrictions' ) ) {
$namespaceRequestValues = $request->getRawVal( 'wpNamespaceRestrictions' );
if ( strlen( $namespaceRequestValues ) > 0 ) {
$namespaceIDs = array_map( 'intval', explode( "\n", $namespaceRequestValues ) );
// Security measure: only allow active namespace IDs to reach the query
$namespaces = array_values( array_intersect( $activeNamespaces, $namespaceIDs ) );
}
}
return $namespaces;
}