Merge "Making sure notification counts are reset on user option changes"

This commit is contained in:
jenkins-bot 2013-04-12 22:40:01 +00:00 committed by Gerrit Code Review
commit f4d033b9b2
2 changed files with 15 additions and 0 deletions

View file

@ -175,6 +175,7 @@ $wgHooks['EchoGetBundleRules'][] = 'EchoHooks::onEchoGetBundleRules';
$wgHooks['ArticleSaveComplete'][] = 'EchoHooks::onArticleSaved'; $wgHooks['ArticleSaveComplete'][] = 'EchoHooks::onArticleSaved';
$wgHooks['AddNewAccount'][] = 'EchoHooks::onAccountCreated'; $wgHooks['AddNewAccount'][] = 'EchoHooks::onAccountCreated';
$wgHooks['ArticleRollbackComplete'][] = 'EchoHooks::onRollbackComplete'; $wgHooks['ArticleRollbackComplete'][] = 'EchoHooks::onRollbackComplete';
$wgHooks['UserSaveSettings'][] = 'EchoHooks::onUserSaveSettings';
// Disable ordinary user talk page email notifications // Disable ordinary user talk page email notifications
$wgHooks['AbortEmailNotification'][] = 'EchoHooks::disableStandUserTalkEnotif'; $wgHooks['AbortEmailNotification'][] = 'EchoHooks::disableStandUserTalkEnotif';

View file

@ -697,4 +697,18 @@ class EchoHooks {
return true; 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;
}
} }