SpecialWatchlist: Don't display '0' in the selector when 'all' is chosen
authorBartosz Dziewoński <matma.rex@gmail.com>
Fri, 4 Dec 2015 15:51:22 +0000 (16:51 +0100)
committerBartosz Dziewoński <matma.rex@gmail.com>
Sun, 6 Dec 2015 23:52:19 +0000 (00:52 +0100)
Follow-up to f3daab99f71eb3e41ae472deb8a71d7d6cbd42db.

Change-Id: I6ffc9b93bc1bd6111224c06f124b1bd01107bbd5

includes/specials/SpecialWatchlist.php

index 34c44d4..8fdfda2 100644 (file)
@@ -523,13 +523,13 @@ class SpecialWatchlist extends ChangesListSpecialPage {
 
                $userWatchlistOption = (string)$this->getUser()->getOption( 'watchlistdays' );
                // add the user preference, if it isn't available already
-               if ( !in_array( $userWatchlistOption, $days ) ) {
+               if ( !in_array( $userWatchlistOption, $days ) && $userWatchlistOption !== '0' ) {
                        $days[] = $userWatchlistOption;
                }
 
                $selected = (string)$options['days'];
                // add the currently selected value, if it isn't available already
-               if ( !in_array( $selected, $days ) ) {
+               if ( !in_array( $selected, $days ) && $selected !== '0' ) {
                        $days[] = $selected;
                }
 
@@ -547,7 +547,7 @@ class SpecialWatchlist extends ChangesListSpecialPage {
 
                // 'all' option
                $name = $this->msg( 'watchlistall2' )->text();
-               $value = 0;
+               $value = '0';
                $select->addOption( $name, $value );
 
                return $select->getHTML() . "\n<br />\n";