jenkins-bot has submitted this change and it was merged. Change subject: Until seentime is recorded, we should treat notifications as unseen ......................................................................
Until seentime is recorded, we should treat notifications as unseen Since we didn't use to save seen time, it is unreliable at first. I decided to just show them as read then, since we couldn't know if they had or hadn't been read. However, it would make more sense to keep them unread until we first save the time a notifiation is seen: it is in line with the current behavior (where the badge just stays red, always) Also fixed a problem where I meant to .get a value but had .set instead. It wasn't noticable because that function is currently only called when things have just been seen, so even though it was wrong, it produced a good result. Bug: T94634 Change-Id: I7ee447249527feb3914c76cfffd673bbda062b75 --- M Hooks.php M modules/overlay/ext.echo.overlay.js 2 files changed, 3 insertions(+), 4 deletions(-) Approvals: Sbisson: Looks good to me, approved jenkins-bot: Verified diff --git a/Hooks.php b/Hooks.php index cea3ebf..75864e8 100644 --- a/Hooks.php +++ b/Hooks.php @@ -654,8 +654,7 @@ if ( $notificationCount == 0 || // no unread notifications $notificationTimestamp === false || // should already always be false if count === 0 - $seenTime === null || // seenTime hasn't yet been recorded, don't rely on it - $notificationTimestamp->getTimestamp( TS_MW ) <= $seenTime // all notifications have already been seen + ( $seenTime !== null && $notificationTimestamp->getTimestamp( TS_MW ) <= $seenTime ) // all notifications have already been seen ) { $linkClasses = array( 'mw-echo-notifications-badge' ); } else { diff --git a/modules/overlay/ext.echo.overlay.js b/modules/overlay/ext.echo.overlay.js index cdc18a8..ecb0a5e 100644 --- a/modules/overlay/ext.echo.overlay.js +++ b/modules/overlay/ext.echo.overlay.js @@ -257,13 +257,13 @@ updateBadgeColor: function () { var $badge = mw.echo.getBadge(), count = this.notificationCount.unreadRaw, - seenTime = mw.user.options.set( 'echo-seen-time' ), + seenTime = mw.user.options.get( 'echo-seen-time' ), seen = true; // figure out if unread notifications in all tabs have already been seen $.each( this.tabs, function ( key, tab ) { var time = tab.getLastUnreadNotificationTime(); - seen = seen && ( time === false || time < seenTime ); + seen = seen && ( time === false || ( seenTime !== null && time < seenTime ) ); } ); if ( !seen && count !== '0' && count !== 0 ) { -- To view, visit https://gerrit.wikimedia.org/r/209189 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7ee447249527feb3914c76cfffd673bbda062b75 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Echo Gerrit-Branch: master Gerrit-Owner: Matthias Mullie <mmul...@wikimedia.org> Gerrit-Reviewer: Sbisson <sbis...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits