mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Thanks
synced 2024-11-23 14:36:47 +00:00
Use LinkTarget in LogFormatter::getPreloadTitles override
Change-Id: I4748927e8656346f7912deec05ba5acaafa44ce9
This commit is contained in:
parent
94ec2c77b6
commit
b26c899229
|
@ -43,7 +43,12 @@
|
|||
"thanks": true
|
||||
},
|
||||
"LogActionsHandlers": {
|
||||
"thanks/*": "MediaWiki\\Extension\\Thanks\\ThanksLogFormatter"
|
||||
"thanks/*": {
|
||||
"class": "MediaWiki\\Extension\\Thanks\\ThanksLogFormatter",
|
||||
"services": [
|
||||
"NamespaceInfo"
|
||||
]
|
||||
}
|
||||
},
|
||||
"APIModules": {
|
||||
"thank": {
|
||||
|
|
|
@ -2,15 +2,26 @@
|
|||
|
||||
namespace MediaWiki\Extension\Thanks;
|
||||
|
||||
use LogEntry;
|
||||
use LogFormatter;
|
||||
use MediaWiki\Message\Message;
|
||||
use MediaWiki\Title\Title;
|
||||
use MediaWiki\Title\NamespaceInfo;
|
||||
use MediaWiki\User\User;
|
||||
|
||||
/**
|
||||
* This class formats log entries for thanks
|
||||
*/
|
||||
class ThanksLogFormatter extends LogFormatter {
|
||||
private NamespaceInfo $namespaceInfo;
|
||||
|
||||
public function __construct(
|
||||
LogEntry $entry,
|
||||
NamespaceInfo $namespaceInfo
|
||||
) {
|
||||
parent::__construct( $entry );
|
||||
$this->namespaceInfo = $namespaceInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
|
@ -26,6 +37,6 @@ class ThanksLogFormatter extends LogFormatter {
|
|||
|
||||
public function getPreloadTitles() {
|
||||
// Add the recipient's user talk page to LinkBatch
|
||||
return [ Title::makeTitle( NS_USER_TALK, $this->entry->getTarget()->getText() ) ];
|
||||
return [ $this->namespaceInfo->getTalkPage( $this->entry->getTarget() ) ];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue