Modify EchoHooks.php to make hook not pass the entire special page

Bug: T257183
Depends-on: I7af57455d412dc5e93617ca0b3d6e7aac8ef500f
Change-Id: I4ec64e5d94a788d0cc1ed3c6e71096e9c830cbd1
This commit is contained in:
shubham656 2020-10-30 19:56:36 +05:30
parent 2f020163ee
commit 90887d290c

View file

@ -1606,20 +1606,22 @@ class EchoHooks implements RecentChange_saveHook {
/**
* Handler for SpecialMuteModifyFormFields hook
*
* @param SpecialMute $specialMute
* @param User|null $target
* @param User $user
* @param array &$fields
*/
public static function onSpecialMuteModifyFormFields( SpecialMute $specialMute, &$fields ) {
public static function onSpecialMuteModifyFormFields( $target, $user, &$fields ) {
$echoPerUserBlacklist = MediaWikiServices::getInstance()->getMainConfig()->get( 'EchoPerUserBlacklist' );
if ( $echoPerUserBlacklist ) {
$target = $specialMute->getTarget();
$id = $target ? CentralIdLookup::factory()->centralIdFromLocalUser( $target ) : 0;
$list = MultiUsernameFilter::splitIds( $user->getOption( 'echo-notifications-blacklist' ) );
$fields[ 'echo-notifications-blacklist'] = [
'type' => 'check',
'label-message' => [
'echo-specialmute-label-mute-notifications',
$target ? $target->getName() : ''
],
'default' => $specialMute->isTargetBlacklisted( 'echo-notifications-blacklist' ),
'default' => in_array( $id, $list, true ),
];
}
}