UserClearNewTalkNotification: Only require a UserIdentity

Bug: T253435
Change-Id: I5e0d7a6300dfd6acda754e6334a6e3f58900d753
This commit is contained in:
DannyS712 2020-05-23 05:06:12 +00:00
parent c56f992a72
commit 37cde0b9f2

View file

@ -1406,12 +1406,13 @@ class EchoHooks {
/**
* Handler for UserClearNewTalkNotification hook.
* @see https://www.mediawiki.org/wiki/Manual:Hooks/UserClearNewTalkNotification
* @param User $user User whose talk page notification should be marked as read
* @param UserIdentity $user User whose talk page notification should be marked as read
*/
public static function onUserClearNewTalkNotification( User $user ) {
if ( !$user->isAnon() ) {
DeferredUpdates::addCallableUpdate( function () use ( $user ) {
MWEchoNotifUser::newFromUser( $user )->clearUserTalkNotifications();
public static function onUserClearNewTalkNotification( UserIdentity $user ) {
if ( $user->isRegistered() ) {
$userObj = User::newFromIdentity( $user );
DeferredUpdates::addCallableUpdate( function () use ( $userObj ) {
MWEchoNotifUser::newFromUser( $userObj )->clearUserTalkNotifications();
} );
}
}