jenkins-bot has submitted this change and it was merged.

Change subject: History in '4 hours ago' should not be included in 'Today'
......................................................................


History in '4 hours ago' should not be included in 'Today'

Change-Id: Iecfa74989cb409db799e500d701f29d06a40dd2e
---
M includes/View/History/HistoryRenderer.php
1 file changed, 7 insertions(+), 5 deletions(-)

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



diff --git a/includes/View/History/HistoryRenderer.php 
b/includes/View/History/HistoryRenderer.php
index 26ae4ba..57247f6 100644
--- a/includes/View/History/HistoryRenderer.php
+++ b/includes/View/History/HistoryRenderer.php
@@ -54,11 +54,13 @@
                $timestampDay = new MWTimestamp( strtotime( date( 'Y-m-d' ) ) );
                $timestampWeek = new MWTimestamp( strtotime( '1 week ago' ) );
 
-               $timespans = array(
-                       wfMessage( 'flow-history-last4' )->escaped() => array( 
'from' => $timestampLast4, 'to' => null ),
-                       wfMessage( 'flow-history-day' )->escaped() => array( 
'from' => $timestampDay, 'to' => $timestampLast4 ),
-                       wfMessage( 'flow-history-week' )->escaped() => array( 
'from' => $timestampWeek, 'to' => $timestampDay ),
-               );
+               $timespans = array();
+               $timespans[wfMessage( 'flow-history-last4' )->escaped()] = 
array( 'from' => $timestampLast4, 'to' => null );
+               // if now is within first 4 hours of the day, all histories 
would be included in '4 hours ago'
+               if ( $timestampDay < $timestampLast4 ) {
+                       $timespans[wfMessage( 'flow-history-day' )->escaped()] 
= array( 'from' => $timestampDay, 'to' => $timestampLast4 );
+               }
+               $timespans[wfMessage( 'flow-history-week' )->escaped()] = 
array( 'from' => $timestampWeek, 'to' => $timestampDay );
 
                // Find last timestamp.
                $history->seek( $history->numRows() - 1 );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iecfa74989cb409db799e500d701f29d06a40dd2e
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Bsitu <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: Matthias Mullie <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to