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 (MessageGroupSubscriptionStore $groupSubscriptionStore, JobQueueGroup $jobQueueGroup, UserIdentityLookup $userIdentityLookup, 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 ( MessageGroupSubscriptionStore $groupSubscriptionStore,
JobQueueGroup $jobQueueGroup,
UserIdentityLookup $userIdentityLookup,
LoggerInterface $logger,
ServiceOptions $options )

Definition at line 42 of file MessageGroupSubscription.php.

Member Function Documentation

◆ canUserSubscribeToGroup()

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

Definition at line 280 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 231 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.

Returns
int[]

Definition at line 248 of file MessageGroupSubscription.php.

◆ getUserSubscriptions()

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

Definition at line 94 of file MessageGroupSubscription.php.

◆ isEnabled()

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

Definition at line 57 of file MessageGroupSubscription.php.

◆ isUserSubscribedTo()

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

Definition at line 71 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 109 of file MessageGroupSubscription.php.

◆ queueNotificationJob()

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

Definition at line 113 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 131 of file MessageGroupSubscription.php.

◆ setMockEventCreator()

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

Definition at line 259 of file MessageGroupSubscription.php.

◆ subscribeToGroup()

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

Definition at line 61 of file MessageGroupSubscription.php.

◆ subscribeToGroupsById()

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

Definition at line 86 of file MessageGroupSubscription.php.

◆ unsubscribeFromGroup()

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

Definition at line 75 of file MessageGroupSubscription.php.

◆ unsubscribeFromGroupsById()

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

Definition at line 79 of file MessageGroupSubscription.php.

Member Data Documentation

◆ CONSTRUCTOR_OPTIONS

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

Definition at line 36 of file MessageGroupSubscription.php.

◆ DYNAMIC_GROUP_UNSUPPORTED

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

Definition at line 40 of file MessageGroupSubscription.php.

◆ NOT_ENABLED

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

Definition at line 38 of file MessageGroupSubscription.php.

◆ STATE_ADDED

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

Definition at line 34 of file MessageGroupSubscription.php.

◆ STATE_UPDATED

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

Definition at line 35 of file MessageGroupSubscription.php.

◆ UNNAMED_USER_UNSUPPORTED

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

Definition at line 39 of file MessageGroupSubscription.php.


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