Merge "Fix seen time for new users"

This commit is contained in:
jenkins-bot 2016-09-13 17:31:59 +00:00 committed by Gerrit Code Review
commit 1f3517e562
2 changed files with 10 additions and 2 deletions

View file

@ -623,6 +623,11 @@ class EchoHooks {
) ); ) );
} }
$seenTime = EchoSeenTime::newFromUser( $user );
// Set seen time to UNIX epoch, so initially all notifications are unseen.
$seenTime->setTime( wfTimestamp( TS_MW, 1 ), 'all' );
return true; return true;
} }

View file

@ -85,8 +85,10 @@ class EchoSeenTime {
} }
if ( $data === false ) { if ( $data === false ) {
// There is still no time set, so set time to 'now' // There is still no time set, so set time to the UNIX epoch.
$data = wfTimestampNow(); // We can't remember their real seen time, so reset everything to
// unseen.
$data = wfTimestamp( TS_MW, 1 );
$this->setTime( $data, $type, $sourceWiki ); $this->setTime( $data, $type, $sourceWiki );
} }
@ -98,6 +100,7 @@ class EchoSeenTime {
* *
* @param string $time Time, in TS_MW format * @param string $time Time, in TS_MW format
* @param string $type Type of seen time to set * @param string $type Type of seen time to set
* @param string $sourceWiki Source wiki to set it for, defaults to current
*/ */
public function setTime( $time, $type = 'all', $sourceWiki = null ) { public function setTime( $time, $type = 'all', $sourceWiki = null ) {
$sourceWiki = $sourceWiki === null ? wfWikiID() : $sourceWiki; $sourceWiki = $sourceWiki === null ? wfWikiID() : $sourceWiki;