Mattflaschen has uploaded a new change for review.
https://gerrit.wikimedia.org/r/309688
Change subject: Fix seen time for new users
......................................................................
Fix seen time for new users
Until the user opens the popup the first time, everything should be
unseen, rather than nothing unseen.
Also, make the default 'everything unseen' if we forget their seen
time.
Change-Id: I99ff8d46d4fa2fab0db374ddff63727b18a68363
---
M Hooks.php
M includes/SeenTime.php
2 files changed, 10 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo
refs/changes/88/309688/1
diff --git a/Hooks.php b/Hooks.php
index 07b7d1e..f0af4bb 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -623,6 +623,11 @@
) );
}
+ $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;
}
diff --git a/includes/SeenTime.php b/includes/SeenTime.php
index 2332101..18894e7 100644
--- a/includes/SeenTime.php
+++ b/includes/SeenTime.php
@@ -85,8 +85,10 @@
}
if ( $data === false ) {
- // There is still no time set, so set time to 'now'
- $data = wfTimestampNow();
+ // There is still no time set, so set time to the UNIX
epoch.
+ // We can't remember their real seen time, so reset
everything to
+ // unseen.
+ $data = wfTimestamp( TS_MW, 1 );
$this->setTime( $data, $type, $sourceWiki );
}
@@ -98,6 +100,7 @@
*
* @param string $time Time, in TS_MW format
* @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 ) {
$sourceWiki = $sourceWiki === null ? wfWikiID() : $sourceWiki;
--
To view, visit https://gerrit.wikimedia.org/r/309688
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I99ff8d46d4fa2fab0db374ddff63727b18a68363
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits