Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| EchoHooks | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| onBeforeCreateEchoEvent | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Extension\FlaggedRevs\Backend; |
| 4 | |
| 5 | use MediaWiki\Extension\Notifications\AttributeManager; |
| 6 | use MediaWiki\Extension\Notifications\Hooks\BeforeCreateEchoEventHook; |
| 7 | use MediaWiki\Extension\Notifications\UserLocator; |
| 8 | |
| 9 | class EchoHooks implements |
| 10 | BeforeCreateEchoEventHook |
| 11 | { |
| 12 | /** |
| 13 | * @see https://www.mediawiki.org/wiki/Manual:Hooks/BeforeCreateEchoEvent |
| 14 | * |
| 15 | * This should go once we can remove all Echo-specific code for reverts, |
| 16 | * see: T153570 |
| 17 | * |
| 18 | * @inheritDoc |
| 19 | */ |
| 20 | public function onBeforeCreateEchoEvent( |
| 21 | array &$notifications, |
| 22 | array &$notificationCategories, |
| 23 | array &$notificationIcons |
| 24 | ) { |
| 25 | // Override default handlers |
| 26 | // FlaggedRevs uses a different 'extra' property to pass multiple reverted users |
| 27 | $notifications['reverted'][AttributeManager::ATTR_LOCATORS][] = [ |
| 28 | [ UserLocator::class, 'locateFromEventExtra' ], |
| 29 | [ 'reverted-users-ids' ] |
| 30 | ]; |
| 31 | } |
| 32 | } |