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

Change subject: Update the badges' seen state when Special:Notifications is 
visited
......................................................................


Update the badges' seen state when Special:Notifications is visited

When the special page is loaded, all notifications should be marked
as seen for both the no-js and JS versions.

Bug: T134855
Change-Id: I053ce07ca26a858fd42c9d070b7dce73cc161e4b
---
M Hooks.php
1 file changed, 7 insertions(+), 3 deletions(-)

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



diff --git a/Hooks.php b/Hooks.php
index 0a719fb..5c37247 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -850,7 +850,6 @@
                $notifUser = MWEchoNotifUser::newFromUser( $user );
                $msgCount = $notifUser->getMessageCount() - $subtractMessages;
                $alertCount = $notifUser->getAlertCount() - $subtractAlerts;
-
                // But make sure we never show a negative number (T130853)
                $msgCount = max( 0, $msgCount );
                $alertCount = max( 0, $alertCount );
@@ -858,8 +857,13 @@
                $msgNotificationTimestamp = 
$notifUser->getLastUnreadMessageTime();
                $alertNotificationTimestamp = 
$notifUser->getLastUnreadAlertTime();
 
-               $seenAlertTime = EchoSeenTime::newFromUser( $user )->getTime( 
'alert', /*flags*/ 0, TS_ISO_8601 );
-               $seenMsgTime = EchoSeenTime::newFromUser( $user )->getTime( 
'message', /*flags*/ 0, TS_ISO_8601 );
+               $seenTime = EchoSeenTime::newFromUser( $user );
+               if ( $title->isSpecial( 'Notifications' ) ) {
+                       // If this is the Special:Notifications page, seenTime 
to now
+                       $seenTime->setTime( wfTimestamp( TS_MW ), 
EchoAttributeManager::ALL );
+               }
+               $seenAlertTime = $seenTime->getTime( 'alert', /*flags*/ 0, 
TS_ISO_8601 );
+               $seenMsgTime = $seenTime->getTime( 'message', /*flags*/ 0, 
TS_ISO_8601 );
 
                $sk->getOutput()->addJsConfigVars( 'wgEchoSeenTime', array(
                        'alert' => $seenAlertTime,

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I053ce07ca26a858fd42c9d070b7dce73cc161e4b
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <mor...@gmail.com>
Gerrit-Reviewer: Catrope <roan.katt...@gmail.com>
Gerrit-Reviewer: Mattflaschen <mflasc...@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

Reply via email to