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

Change subject: Making sure notification counts are reset on user option changes
......................................................................


Making sure notification counts are reset on user option changes

Bug: 47131
Change-Id: I5244ef9f7bf9d1217c0c0df6691d8cf689c47cf5
---
M Echo.php
M Hooks.php
2 files changed, 15 insertions(+), 0 deletions(-)

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



diff --git a/Echo.php b/Echo.php
index 60868e9..ec22895 100644
--- a/Echo.php
+++ b/Echo.php
@@ -175,6 +175,7 @@
 $wgHooks['ArticleSaveComplete'][] = 'EchoHooks::onArticleSaved';
 $wgHooks['AddNewAccount'][] = 'EchoHooks::onAccountCreated';
 $wgHooks['ArticleRollbackComplete'][] = 'EchoHooks::onRollbackComplete';
+$wgHooks['UserSaveSettings'][] = 'EchoHooks::onUserSaveSettings';
 
 // Disable ordinary user talk page email notifications
 $wgHooks['AbortEmailNotification'][] = 'EchoHooks::disableStandUserTalkEnotif';
diff --git a/Hooks.php b/Hooks.php
index 9616228..a953f63 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -697,4 +697,18 @@
 
                return true;
        }
+
+       /**
+        * Handler for UserSaveSettings hook.
+        * @see http://www.mediawiki.org/wiki/Manual:Hooks/UserSaveSettings
+        * @param $user User whose settings were saved
+        * @return bool true in all cases
+        */
+       static function onUserSaveSettings( $user ) {
+               // Reset the notification count since it may have changed due 
to user
+               // option changes. This covers both explicit changes in the 
preferences
+               // and changes made through the options API (since both call 
this hook).
+               EchoNotificationController::resetNotificationCount( $user, 
DB_MASTER );
+               return true;
+       }
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5244ef9f7bf9d1217c0c0df6691d8cf689c47cf5
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Kaldari <[email protected]>
Gerrit-Reviewer: Alex Monk <[email protected]>
Gerrit-Reviewer: Bsitu <[email protected]>
Gerrit-Reviewer: Lwelling <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to