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