Florianschmidtwelzow has uploaded a new change for review.

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

Change subject: Special:Watchlist: Add the user preference to the show last 
select options
......................................................................

Special:Watchlist: Add the user preference to the show last select options

Also, simplified the "selected" check:
if ( $a == $b ) {
        return true;
} else {
        return false;
}

doesn't make sense, if you can use:
return $a == $b;

Bug: T119172
Change-Id: I16e1713bcd6519695961fcaf094a214954e7769c
---
M includes/specials/SpecialWatchlist.php
1 file changed, 7 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/73/254373/1

diff --git a/includes/specials/SpecialWatchlist.php 
b/includes/specials/SpecialWatchlist.php
index 2feaa9e..db905bf 100644
--- a/includes/specials/SpecialWatchlist.php
+++ b/includes/specials/SpecialWatchlist.php
@@ -507,21 +507,26 @@
        }
 
        function cutoffselector( $options ) {
+               $user = $this->getUser();
                $list = array();
                $selectOptions = '';
                $hours = array( 1, 2, 6, 12 );
                $days = array( 1, 3, 7 );
+               // add the user preference, if it isn't available already
+               if ( !in_array( $user->getOption( 'watchlistdays' ), $days ) ) {
+                       $days[] = $user->getOption( 'watchlistdays' );
+               }
                foreach ( $hours as $h ) {
                        $name = $this->msg( 'hours', $h );
                        $value = $h / 24;
-                       $selected = ( $value == $options['days'] ) ? true : 
false;
+                       $selected = $value == $options['days'];
 
                        $selectOptions .= Xml::option( $name, $value, $selected 
);
                }
                foreach ( $days as $d ) {
                        $name = $this->msg( 'days', $d );
                        $value = $d;
-                       $selected = ( $value == $options['days'] ) ? true : 
false;
+                       $selected = $value == $options['days'];
 
                        $selectOptions .= Xml::option( $name, $value, $selected 
);
                }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I16e1713bcd6519695961fcaf094a214954e7769c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>

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

Reply via email to