Translate extension for MediaWiki
 
Loading...
Searching...
No Matches
MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroupSubscription Class Reference

Manage user subscriptions to message groups and trigger notifications. More...

Public Member Functions

 __construct (private readonly MessageGroupSubscriptionStore $groupSubscriptionStore, private readonly JobQueueGroup $jobQueueGroup, private readonly UserIdentityLookup $userIdentityLookup, private readonly LoggerInterface $logger, ServiceOptions $options)
 
 isEnabled ()
 
 subscribeToGroup (MessageGroup $group, User $user)
 
 isUserSubscribedTo (MessageGroup $group, UserIdentity $user)
 
 unsubscribeFromGroup (MessageGroup $group, UserIdentity $user)
 
 unsubscribeFromGroupsById (array $groupIds, UserIdentity $user)
 
 subscribeToGroupsById (array $groupIds, UserIdentity $user)
 
 getUserSubscriptions (UserIdentity $user)
 
 queueMessage (Title $messageTitle, string $state, string $groupId)
 Queue a message / group to send notifications for.
 
 queueNotificationJob ()
 
 sendNotifications (array $changesToProcess)
 
 getGroupSubscribers (string $groupId)
 Given a group id returns an iterator to the subscribers of that group.
 
 getGroupSubscriberUnion (array $groupIds)
 Return a list of users ids that belong to all the given groups.
 
 setMockEventCreator (MockEventCreator $mockEventCreator)
 
 canUserSubscribeToGroup (MessageGroup $group, User $user)
 

Public Attributes

const STATE_ADDED = 'added'
 
const STATE_UPDATED = 'updated'
 
const CONSTRUCTOR_OPTIONS = [ 'TranslateEnableMessageGroupSubscription' ]
 
const NOT_ENABLED = 'mgs-not-enabled'
 
const UNNAMED_USER_UNSUPPORTED = 'mgs-unnamed-user-unsupported'
 
const DYNAMIC_GROUP_UNSUPPORTED = 'mgs-dynamic-group-unsupported'
 

Detailed Description

Manage user subscriptions to message groups and trigger notifications.

Since
2024.04 @license GPL-2.0-or-later
Author
Abijeet Patro

Definition at line 25 of file MessageGroupSubscription.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroupSubscription::__construct ( private readonly MessageGroupSubscriptionStore $groupSubscriptionStore,
private readonly JobQueueGroup $jobQueueGroup,
private readonly UserIdentityLookup $userIdentityLookup,
private readonly LoggerInterface $logger,
ServiceOptions $options )

Definition at line 39 of file MessageGroupSubscription.php.

Member Function Documentation

◆ canUserSubscribeToGroup()

MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroupSubscription::canUserSubscribeToGroup ( MessageGroup $group,
User $user )

Definition at line 257 of file MessageGroupSubscription.php.

◆ getGroupSubscribers()

MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroupSubscription::getGroupSubscribers ( string $groupId)

Given a group id returns an iterator to the subscribers of that group.

Returns an EmptyIterator if there are no subscribers

Returns
Iterator<UserIdentity>

Definition at line 220 of file MessageGroupSubscription.php.

◆ getGroupSubscriberUnion()

MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroupSubscription::getGroupSubscriberUnion ( array $groupIds)

Return a list of users ids that belong to all the given groups.

Parameters
string[]$groupIds
Returns
int[]

Definition at line 239 of file MessageGroupSubscription.php.

◆ getUserSubscriptions()

MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroupSubscription::getUserSubscriptions ( UserIdentity $user)
Returns
string[]

Definition at line 87 of file MessageGroupSubscription.php.

◆ isEnabled()

MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroupSubscription::isEnabled ( )

Definition at line 50 of file MessageGroupSubscription.php.

◆ isUserSubscribedTo()

MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroupSubscription::isUserSubscribedTo ( MessageGroup $group,
UserIdentity $user )

Definition at line 64 of file MessageGroupSubscription.php.

◆ queueMessage()

MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroupSubscription::queueMessage ( Title $messageTitle,
string $state,
string $groupId )

Queue a message / group to send notifications for.

Parameters
Title$messageTitle
string$state
Returns
void

Definition at line 98 of file MessageGroupSubscription.php.

◆ queueNotificationJob()

MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroupSubscription::queueNotificationJob ( )

Definition at line 102 of file MessageGroupSubscription.php.

◆ sendNotifications()

MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroupSubscription::sendNotifications ( array $changesToProcess)
Parameters
array<string,array<string,array<int,string>>>$changesToProcess Group ID → state → array of message prefixed DB keys map

Definition at line 120 of file MessageGroupSubscription.php.

◆ setMockEventCreator()

MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroupSubscription::setMockEventCreator ( MockEventCreator $mockEventCreator)

Definition at line 243 of file MessageGroupSubscription.php.

◆ subscribeToGroup()

MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroupSubscription::subscribeToGroup ( MessageGroup $group,
User $user )

Definition at line 54 of file MessageGroupSubscription.php.

◆ subscribeToGroupsById()

MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroupSubscription::subscribeToGroupsById ( array $groupIds,
UserIdentity $user )

Definition at line 79 of file MessageGroupSubscription.php.

◆ unsubscribeFromGroup()

MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroupSubscription::unsubscribeFromGroup ( MessageGroup $group,
UserIdentity $user )

Definition at line 68 of file MessageGroupSubscription.php.

◆ unsubscribeFromGroupsById()

MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroupSubscription::unsubscribeFromGroupsById ( array $groupIds,
UserIdentity $user )

Definition at line 72 of file MessageGroupSubscription.php.

Member Data Documentation

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroupSubscription::CONSTRUCTOR_OPTIONS = [ 'TranslateEnableMessageGroupSubscription' ]

Definition at line 33 of file MessageGroupSubscription.php.

◆ DYNAMIC_GROUP_UNSUPPORTED

const MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroupSubscription::DYNAMIC_GROUP_UNSUPPORTED = 'mgs-dynamic-group-unsupported'

Definition at line 37 of file MessageGroupSubscription.php.

◆ NOT_ENABLED

const MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroupSubscription::NOT_ENABLED = 'mgs-not-enabled'

Definition at line 35 of file MessageGroupSubscription.php.

◆ STATE_ADDED

const MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroupSubscription::STATE_ADDED = 'added'

Definition at line 31 of file MessageGroupSubscription.php.

◆ STATE_UPDATED

const MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroupSubscription::STATE_UPDATED = 'updated'

Definition at line 32 of file MessageGroupSubscription.php.

◆ UNNAMED_USER_UNSUPPORTED

const MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroupSubscription::UNNAMED_USER_UNSUPPORTED = 'mgs-unnamed-user-unsupported'

Definition at line 36 of file MessageGroupSubscription.php.


The documentation for this class was generated from the following file: