mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-12-18 11:02:57 +00:00
52ae0f3152
When permalink data is available, display a permalink using the current page title, instead of a plain link to the section at the time of subscription. Consolidate and clean up some existing permalink code. Bug: T306373 Change-Id: Ie2f63cbfdbfa703530205201dfcfb0e5ad053b35
68 lines
1.7 KiB
PHP
68 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace MediaWiki\Extension\DiscussionTools;
|
|
|
|
use ErrorPageError;
|
|
use MediaWiki\Cache\LinkBatchFactory;
|
|
use MediaWiki\Linker\LinkRenderer;
|
|
use MediaWiki\SpecialPage\SpecialPage;
|
|
|
|
class SpecialTopicSubscriptions extends SpecialPage {
|
|
|
|
private LinkRenderer $linkRenderer;
|
|
private LinkBatchFactory $linkBatchFactory;
|
|
private ThreadItemStore $threadItemStore;
|
|
private ThreadItemFormatter $threadItemFormatter;
|
|
|
|
public function __construct(
|
|
LinkRenderer $linkRenderer,
|
|
LinkBatchFactory $linkBatchFactory,
|
|
ThreadItemStore $threadItemStore,
|
|
ThreadItemFormatter $threadItemFormatter
|
|
) {
|
|
parent::__construct( 'TopicSubscriptions' );
|
|
$this->linkRenderer = $linkRenderer;
|
|
$this->linkBatchFactory = $linkBatchFactory;
|
|
$this->threadItemStore = $threadItemStore;
|
|
$this->threadItemFormatter = $threadItemFormatter;
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
* @throws ErrorPageError
|
|
*/
|
|
public function execute( $subpage ) {
|
|
$this->requireNamedUser();
|
|
|
|
parent::execute( $subpage );
|
|
|
|
$this->getOutput()->addModules( [ 'ext.discussionTools.init' ] );
|
|
|
|
$this->getOutput()->addHtml( $this->msg( 'discussiontools-topicsubscription-special-intro' )->parseAsBlock() );
|
|
|
|
$this->getOutput()->enableOOUI();
|
|
$pager = new TopicSubscriptionsPager(
|
|
$this->getContext(),
|
|
$this->linkRenderer,
|
|
$this->linkBatchFactory,
|
|
$this->threadItemStore,
|
|
$this->threadItemFormatter
|
|
);
|
|
$this->getOutput()->addParserOutputContent( $pager->getFullOutput() );
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function getDescription() {
|
|
return $this->msg( 'discussiontools-topicsubscription-special-title' );
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
protected function getGroupName() {
|
|
return 'login';
|
|
}
|
|
}
|