mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-24 00:13:36 +00:00
Injected SubscriptionStore into UnsubscribeAction
Dependency injection is now available to actions, extension already requires MW 1.37+ Bug: T253078 Change-Id: I473abac19ed5e6f3c6706797e91704ff635f64c6
This commit is contained in:
parent
b46893eb7d
commit
88ba997bed
|
@ -413,7 +413,12 @@
|
|||
}
|
||||
},
|
||||
"Actions": {
|
||||
"dtunsubscribe": "MediaWiki\\Extension\\DiscussionTools\\Actions\\UnsubscribeAction"
|
||||
"dtunsubscribe": {
|
||||
"class": "MediaWiki\\Extension\\DiscussionTools\\Actions\\UnsubscribeAction",
|
||||
"services": [
|
||||
"DiscussionTools.SubscriptionStore"
|
||||
]
|
||||
}
|
||||
},
|
||||
"ServiceWiringFiles": [
|
||||
"includes/ServiceWiring.php"
|
||||
|
|
|
@ -9,7 +9,6 @@ use HTMLForm;
|
|||
use IContextSource;
|
||||
use MediaWiki\Extension\DiscussionTools\SubscriptionItem;
|
||||
use MediaWiki\Extension\DiscussionTools\SubscriptionStore;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use Page;
|
||||
use Title;
|
||||
use User;
|
||||
|
@ -24,10 +23,17 @@ class UnsubscribeAction extends FormAction {
|
|||
protected $subscriptionItem = null;
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @param Page $page
|
||||
* @param IContextSource $context
|
||||
* @param SubscriptionStore $subscriptionStore
|
||||
*/
|
||||
public function __construct( Page $page, IContextSource $context = null ) {
|
||||
public function __construct(
|
||||
Page $page,
|
||||
IContextSource $context,
|
||||
SubscriptionStore $subscriptionStore
|
||||
) {
|
||||
parent::__construct( $page, $context );
|
||||
$this->subscriptionStore = $subscriptionStore;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,8 +57,6 @@ class UnsubscribeAction extends FormAction {
|
|||
$commentName = $this->getRequest()->getVal( 'commentname' );
|
||||
|
||||
if ( $commentName ) {
|
||||
$this->subscriptionStore =
|
||||
MediaWikiServices::getInstance()->getService( 'DiscussionTools.SubscriptionStore' );
|
||||
$subscriptionItems = $this->subscriptionStore->getSubscriptionItemsForUser(
|
||||
$this->getUser(),
|
||||
[ $commentName ]
|
||||
|
|
Loading…
Reference in a new issue