| 1 |
<?php |
| 2 |
|
| 3 |
namespace MediaWiki\Extension\AbuseFilter\Hooks\Handlers; |
| 4 |
|
| 5 |
use MediaWiki\Extension\AbuseFilter\EchoNotifier; |
| 6 |
use MediaWiki\Extension\AbuseFilter\ThrottleFilterPresentationModel; |
| 7 |
use MediaWiki\Extension\Notifications\AttributeManager; |
| 8 |
use MediaWiki\Extension\Notifications\Hooks\BeforeCreateEchoEventHook; |
| 9 |
use MediaWiki\Extension\Notifications\UserLocator; |
| 10 |
|
| 11 |
class EchoHandler implements BeforeCreateEchoEventHook { |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
public function onBeforeCreateEchoEvent( |
| 19 |
array &$notifications, |
| 20 |
array &$notificationCategories, |
| 21 |
array &$icons |
| 22 |
) { |
| 23 |
$notifications[ EchoNotifier::EVENT_TYPE ] = [ |
| 24 |
'category' => 'system', |
| 25 |
'section' => 'alert', |
| 26 |
'group' => 'negative', |
| 27 |
'presentation-model' => ThrottleFilterPresentationModel::class, |
| 28 |
AttributeManager::ATTR_LOCATORS => [ |
| 29 |
[ |
| 30 |
[ UserLocator::class, 'locateFromEventExtra' ], |
| 31 |
[ 'user' ] |
| 32 |
] |
| 33 |
], |
| 34 |
]; |
| 35 |
} |
| 36 |
|
| 37 |
} |