Nemo bis has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/137005

Change subject: Simplify check for namespaces in search preferences
......................................................................

Simplify check for namespaces in search preferences

Followup I514cee83 (5dc4dc099).

Change-Id: Icad951fb9a4c4cb368cd994d1861dc2eff1f4ae0

Followup I514cee83 (5dc4dc099).

Change-Id: Icad951fb9a4c4cb368cd994d1861dc2eff1f4ae0
---
M includes/Preferences.php
M includes/specials/SpecialSearch.php
2 files changed, 4 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/05/137005/1

diff --git a/includes/Preferences.php b/includes/Preferences.php
index 62aac3b..081315e 100644
--- a/includes/Preferences.php
+++ b/includes/Preferences.php
@@ -1011,11 +1011,9 @@
         */
        static function searchPreferences( $user, IContextSource $context, 
&$defaultPreferences ) {
                foreach ( MWNamespace::getValidNamespaces() as $n ) {
-                       if ( $n >= 0 ) {
-                               $defaultPreferences[ 'searchNs' . $n ] = array(
-                                       'type' => 'api',
-                               );
-                       }
+                       $defaultPreferences[ 'searchNs' . $n ] = array(
+                               'type' => 'api',
+                       );
                }
        }
 
diff --git a/includes/specials/SpecialSearch.php 
b/includes/specials/SpecialSearch.php
index ee7ddfd..ea0a29a 100644
--- a/includes/specials/SpecialSearch.php
+++ b/includes/specials/SpecialSearch.php
@@ -539,9 +539,7 @@
                        // Reset namespace preferences: namespaces are not 
searched
                        // when they're not mentioned in the URL parameters.
                        foreach ( MWNamespace::getValidNamespaces() as $n ) {
-                               if ( $n >= 0 ) {
-                                       $user->setOption( 'searchNs' . $n, 
false );
-                               }
+                               $user->setOption( 'searchNs' . $n, false );
                        }
                        // The request parameters include all the namespaces we 
just searched.
                        // Even if they're the same as an existing profile, 
they're not eaten.

-- 
To view, visit https://gerrit.wikimedia.org/r/137005
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icad951fb9a4c4cb368cd994d1861dc2eff1f4ae0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Nemo bis <federicol...@tiscali.it>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to