mediawiki-extensions-Thanks/includes/ThanksLogFormatter.php
gerritbot e2ed94cff3 Replace some moved Title class uses, now MediaWiki\Title\Title
Bug: T321681
Change-Id: I491f0a12aaa4d70a4b6eccda3a478b223896feaa
2023-08-19 14:27:12 +00:00

32 lines
828 B
PHP

<?php
namespace MediaWiki\Extension\Thanks;
use LogFormatter;
use MediaWiki\Title\Title;
use Message;
use User;
/**
* This class formats log entries for thanks
*/
class ThanksLogFormatter extends LogFormatter {
/**
* @inheritDoc
*/
protected function getMessageParameters() {
$params = parent::getMessageParameters();
// Convert target from a pageLink to a userLink since the target is
// actually a user, not a page.
$recipient = User::newFromName( $this->entry->getTarget()->getText(), false );
$params[2] = Message::rawParam( $this->makeUserLink( $recipient ) );
$params[3] = $recipient->getName();
return $params;
}
public function getPreloadTitles() {
// Add the recipient's user talk page to LinkBatch
return [ Title::makeTitle( NS_USER_TALK, $this->entry->getTarget()->getText() ) ];
}
}