diff --git a/Echo.php b/Echo.php index 60868e9ff..ec228950c 100644 --- a/Echo.php +++ b/Echo.php @@ -175,6 +175,7 @@ $wgHooks['EchoGetBundleRules'][] = 'EchoHooks::onEchoGetBundleRules'; $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 961622899..a953f6337 100644 --- a/Hooks.php +++ b/Hooks.php @@ -697,4 +697,18 @@ class EchoHooks { 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; + } }