2013-04-10 03:45:44 +00:00
|
|
|
<?php
|
2018-11-10 21:06:01 +00:00
|
|
|
|
2021-03-14 03:43:32 +00:00
|
|
|
namespace MediaWiki\Extension\Thanks;
|
|
|
|
|
|
|
|
use LogFormatter;
|
2023-08-19 04:19:52 +00:00
|
|
|
use MediaWiki\Title\Title;
|
2024-01-04 21:22:56 +00:00
|
|
|
use MediaWiki\User\User;
|
2021-03-14 03:43:32 +00:00
|
|
|
use Message;
|
|
|
|
|
2013-04-10 03:45:44 +00:00
|
|
|
/**
|
|
|
|
* This class formats log entries for thanks
|
|
|
|
*/
|
|
|
|
class ThanksLogFormatter extends LogFormatter {
|
2018-08-23 09:36:19 +00:00
|
|
|
/**
|
|
|
|
* @inheritDoc
|
|
|
|
*/
|
2013-04-10 03:45:44 +00:00
|
|
|
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 ) );
|
2013-08-20 23:23:37 +00:00
|
|
|
$params[3] = $recipient->getName();
|
2013-04-10 03:45:44 +00:00
|
|
|
return $params;
|
|
|
|
}
|
2016-04-22 20:13:56 +00:00
|
|
|
|
2013-04-10 03:45:44 +00:00
|
|
|
public function getPreloadTitles() {
|
|
|
|
// Add the recipient's user talk page to LinkBatch
|
2016-04-22 20:13:56 +00:00
|
|
|
return [ Title::makeTitle( NS_USER_TALK, $this->entry->getTarget()->getText() ) ];
|
2013-04-10 03:45:44 +00:00
|
|
|
}
|
|
|
|
}
|