From: Brad Jorsch Date: Wed, 27 Sep 2017 12:01:58 +0000 (-0400) Subject: Fix watchlist "in the last X hours" display X-Git-Tag: 1.31.0-rc.0~1948 X-Git-Url: https://git.cyclocoop.org/?a=commitdiff_plain;h=c728912b38bc220a60ba159272428380661d19a0;p=lhc%2Fweb%2Fwiklou.git Fix watchlist "in the last X hours" display If6280ad6 changed the interpretation of the URL parameter "days=0" (or any negative value) from meaning "maximum number of days" to actually meaning "0 days". That's a somewhat annoying breaking change, but easily worked around by updating bookmarks. But it didn't update the display on the page, so despite querying 0 days it would still incorrectly say something like "in the last 720 hours" rather than "in the last 0 hours". Bug: T176857 Change-Id: I90c79ef9c4819a34060515b863277fd185828ed9 --- diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index 531184b65f..8a474864f0 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -608,11 +608,6 @@ class SpecialWatchlist extends ChangesListSpecialPage { } $lang = $this->getLanguage(); - if ( $opts['days'] > 0 ) { - $days = $opts['days']; - } else { - $days = $this->maxDays; - } $timestamp = wfTimestampNow(); $wlInfo = Html::rawElement( 'span', @@ -620,7 +615,7 @@ class SpecialWatchlist extends ChangesListSpecialPage { 'class' => 'wlinfo', 'data-params' => json_encode( [ 'from' => $timestamp ] ), ], - $this->msg( 'wlnote' )->numParams( $numRows, round( $days * 24 ) )->params( + $this->msg( 'wlnote' )->numParams( $numRows, round( $opts['days'] * 24 ) )->params( $lang->userDate( $timestamp, $user ), $lang->userTime( $timestamp, $user ) )->parse() ) . "
\n";