EchoHooks: Use symbols instead of string class names

Change-Id: I3a4bba84d939f23653b719a271cecaa9395f0cd0
This commit is contained in:
Ed Sanders 2023-06-08 17:52:12 +01:00 committed by Bartosz Dziewoński
parent f9580e6817
commit 531ced9e31

View file

@ -9,7 +9,13 @@
namespace MediaWiki\Extension\DiscussionTools\Hooks; namespace MediaWiki\Extension\DiscussionTools\Hooks;
use EchoUserLocator;
use MediaWiki\Extension\DiscussionTools\Notifications\AddedTopicPresentationModel;
use MediaWiki\Extension\DiscussionTools\Notifications\EnhancedEchoEditUserTalkPresentationModel;
use MediaWiki\Extension\DiscussionTools\Notifications\EnhancedEchoMentionPresentationModel;
use MediaWiki\Extension\DiscussionTools\Notifications\EventDispatcher; use MediaWiki\Extension\DiscussionTools\Notifications\EventDispatcher;
use MediaWiki\Extension\DiscussionTools\Notifications\RemovedTopicPresentationModel;
use MediaWiki\Extension\DiscussionTools\Notifications\SubscribedNewCommentPresentationModel;
use MediaWiki\Extension\Notifications\Model\Event; use MediaWiki\Extension\Notifications\Model\Event;
use MediaWiki\Revision\RevisionRecord; use MediaWiki\Revision\RevisionRecord;
@ -35,19 +41,18 @@ class EchoHooks {
'group' => 'interactive', 'group' => 'interactive',
'section' => 'message', 'section' => 'message',
'user-locators' => [ 'user-locators' => [
'MediaWiki\\Extension\\DiscussionTools\\Notifications\\EventDispatcher::locateSubscribedUsers' [ [ EventDispatcher::class, 'locateSubscribedUsers' ] ]
], ],
// Exclude mentioned users and talk page owner from our notification, to avoid // Exclude mentioned users and talk page owner from our notification, to avoid
// duplicate notifications for a single comment // duplicate notifications for a single comment
'user-filters' => [ 'user-filters' => [
[ [
"EchoUserLocator::locateFromEventExtra", [ EchoUserLocator::class, 'locateFromEventExtra' ],
[ "mentioned-users" ] [ 'mentioned-users' ]
], ],
"EchoUserLocator::locateTalkPageOwner" [ [ EchoUserLocator::class, 'locateTalkPageOwner' ] ],
], ],
'presentation-model' => 'presentation-model' => SubscribedNewCommentPresentationModel::class,
'MediaWiki\\Extension\\DiscussionTools\\Notifications\\SubscribedNewCommentPresentationModel',
'bundle' => [ 'bundle' => [
'web' => true, 'web' => true,
'email' => true, 'email' => true,
@ -64,10 +69,9 @@ class EchoHooks {
'group' => 'interactive', 'group' => 'interactive',
'section' => 'message', 'section' => 'message',
'user-locators' => [ 'user-locators' => [
'MediaWiki\\Extension\\DiscussionTools\\Notifications\\EventDispatcher::locateSubscribedUsers' [ [ EventDispatcher::class, 'locateSubscribedUsers' ] ]
], ],
'presentation-model' => 'presentation-model' => RemovedTopicPresentationModel::class,
'MediaWiki\\Extension\\DiscussionTools\\Notifications\\RemovedTopicPresentationModel',
'bundle' => [ 'bundle' => [
'web' => true, 'web' => true,
'email' => true, 'email' => true,
@ -79,10 +83,9 @@ class EchoHooks {
'group' => 'interactive', 'group' => 'interactive',
'section' => 'message', 'section' => 'message',
'user-locators' => [ 'user-locators' => [
'MediaWiki\\Extension\\DiscussionTools\\Notifications\\EventDispatcher::locateSubscribedUsers' [ [ EventDispatcher::class, 'locateSubscribedUsers' ] ]
], ],
'presentation-model' => 'presentation-model' => AddedTopicPresentationModel::class,
'MediaWiki\\Extension\\DiscussionTools\\Notifications\\AddedTopicPresentationModel',
'bundle' => [ 'bundle' => [
'web' => true, 'web' => true,
'email' => true, 'email' => true,
@ -91,10 +94,8 @@ class EchoHooks {
]; ];
// Override default handlers // Override default handlers
$notifications['edit-user-talk']['presentation-model'] = $notifications['edit-user-talk']['presentation-model'] = EnhancedEchoEditUserTalkPresentationModel::class;
'MediaWiki\\Extension\\DiscussionTools\\Notifications\\EnhancedEchoEditUserTalkPresentationModel'; $notifications['mention']['presentation-model'] = EnhancedEchoMentionPresentationModel::class;
$notifications['mention']['presentation-model'] =
'MediaWiki\\Extension\\DiscussionTools\\Notifications\\EnhancedEchoMentionPresentationModel';
} }
/** /**