Merge "EchoHooks: Use symbols instead of string class names"

This commit is contained in:
jenkins-bot 2023-06-09 20:59:21 +00:00 committed by Gerrit Code Review
commit b6ebb59c5f

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;
}
/**