jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/378124 )

Change subject: RCFilters: Don't cast days default to an integer
......................................................................


RCFilters: Don't cast days default to an integer

Values can be floats, like 1.5 days, etc. Cast instead to a float.

Bug: T175965
Change-Id: I14ba792f1cd435f89b2e09067b0a0e894a0a2557
---
M includes/specialpage/ChangesListSpecialPage.php
M includes/specials/SpecialRecentchanges.php
M includes/specials/SpecialWatchlist.php
3 files changed, 13 insertions(+), 8 deletions(-)

Approvals:
  Mattflaschen: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/specialpage/ChangesListSpecialPage.php 
b/includes/specialpage/ChangesListSpecialPage.php
index ec09559..98b7aa1 100644
--- a/includes/specialpage/ChangesListSpecialPage.php
+++ b/includes/specialpage/ChangesListSpecialPage.php
@@ -1580,5 +1580,12 @@
 
        abstract function getDefaultLimit();
 
+       /**
+        * Get the default value of the number of days to display when loading
+        * the result set.
+        * Supports fractional values, and should be cast to a float.
+        *
+        * @return float
+        */
        abstract function getDefaultDays();
 }
diff --git a/includes/specials/SpecialRecentchanges.php 
b/includes/specials/SpecialRecentchanges.php
index 547a1b0..15c05ee 100644
--- a/includes/specials/SpecialRecentchanges.php
+++ b/includes/specials/SpecialRecentchanges.php
@@ -233,10 +233,9 @@
         */
        public function getDefaultOptions() {
                $opts = parent::getDefaultOptions();
-               $user = $this->getUser();
 
-               $opts->add( 'days', $user->getIntOption( 'rcdays' ), 
FormOptions::FLOAT );
-               $opts->add( 'limit', $user->getIntOption( 'rclimit' ) );
+               $opts->add( 'days', $this->getDefaultDays(), FormOptions::FLOAT 
);
+               $opts->add( 'limit', $this->getDefaultLimit() );
                $opts->add( 'from', '' );
 
                $opts->add( 'categories', '' );
@@ -1010,6 +1009,6 @@
        }
 
        function getDefaultDays() {
-               return $this->getUser()->getIntOption( 'rcdays' );
+               return floatval( $this->getUser()->getOption( 'rcdays' ) );
        }
 }
diff --git a/includes/specials/SpecialWatchlist.php 
b/includes/specials/SpecialWatchlist.php
index ec64869..2750551 100644
--- a/includes/specials/SpecialWatchlist.php
+++ b/includes/specials/SpecialWatchlist.php
@@ -277,10 +277,9 @@
         */
        public function getDefaultOptions() {
                $opts = parent::getDefaultOptions();
-               $user = $this->getUser();
 
-               $opts->add( 'days', $user->getOption( 'watchlistdays' ), 
FormOptions::FLOAT );
-               $opts->add( 'limit', $user->getIntOption( 'wllimit' ), 
FormOptions::INT );
+               $opts->add( 'days', $this->getDefaultDays(), FormOptions::FLOAT 
);
+               $opts->add( 'limit', $this->getDefaultLimit(), FormOptions::INT 
);
 
                return $opts;
        }
@@ -918,6 +917,6 @@
        }
 
        function getDefaultDays() {
-               return $this->getUser()->getIntOption( 'watchlistdays' );
+               return floatval( $this->getUser()->getOption( 'watchlistdays' ) 
);
        }
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I14ba792f1cd435f89b2e09067b0a0e894a0a2557
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <mor...@gmail.com>
Gerrit-Reviewer: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>
Gerrit-Reviewer: Mattflaschen <mflasc...@wikimedia.org>
Gerrit-Reviewer: Mooeypoo <mor...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to