mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-14 11:16:16 +00:00
Merge "Fix seen time for new users"
This commit is contained in:
commit
1f3517e562
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue