|
|
@ -2,6 +2,7 @@
|
|
|
|
namespace Isekai\AIReview;
|
|
|
|
namespace Isekai\AIReview;
|
|
|
|
|
|
|
|
|
|
|
|
use LogFormatter as GlobalLogFormatter;
|
|
|
|
use LogFormatter as GlobalLogFormatter;
|
|
|
|
|
|
|
|
use MediaWiki\MediaWikiServices;
|
|
|
|
use SpecialPage;
|
|
|
|
use SpecialPage;
|
|
|
|
use Message;
|
|
|
|
use Message;
|
|
|
|
use Linker;
|
|
|
|
use Linker;
|
|
|
@ -9,18 +10,18 @@ use Title;
|
|
|
|
use User;
|
|
|
|
use User;
|
|
|
|
|
|
|
|
|
|
|
|
class LogFormatter extends GlobalLogFormatter {
|
|
|
|
class LogFormatter extends GlobalLogFormatter {
|
|
|
|
public function getMessageParameters(){
|
|
|
|
/**
|
|
|
|
$params = parent::getMessageParameters();
|
|
|
|
* @param array $params
|
|
|
|
|
|
|
|
* @return array
|
|
|
|
$type = $this->entry->getSubtype();
|
|
|
|
* @throws \MWException
|
|
|
|
$entryParams = $this->entry->getParameters();
|
|
|
|
*/
|
|
|
|
|
|
|
|
public function buildBaseParams(array $params): array {
|
|
|
|
|
|
|
|
$services = MediaWikiServices::getInstance();
|
|
|
|
$linkRenderer = $this->getLinkRenderer();
|
|
|
|
$linkRenderer = $this->getLinkRenderer();
|
|
|
|
|
|
|
|
$entryParams = $this->entry->getParameters();
|
|
|
|
switch($type){
|
|
|
|
|
|
|
|
case 'approve':
|
|
|
|
|
|
|
|
$modId = $entryParams['modid'];
|
|
|
|
$modId = $entryParams['modid'];
|
|
|
|
|
|
|
|
|
|
|
|
$user = User::newFromId($entryParams['moduser']);
|
|
|
|
$user = $services->getUserFactory()->newFromId($entryParams['moduser']);
|
|
|
|
$userLink = Linker::userLink($user->getId(), $user->getName());
|
|
|
|
$userLink = Linker::userLink($user->getId(), $user->getName());
|
|
|
|
$params[3] = Message::rawParam($userLink);
|
|
|
|
$params[3] = Message::rawParam($userLink);
|
|
|
|
|
|
|
|
|
|
|
@ -31,22 +32,21 @@ class LogFormatter extends GlobalLogFormatter {
|
|
|
|
['modaction' => 'show', 'modid' => $modId]
|
|
|
|
['modaction' => 'show', 'modid' => $modId]
|
|
|
|
);
|
|
|
|
);
|
|
|
|
$params[4] = Message::rawParam($link);
|
|
|
|
$params[4] = Message::rawParam($link);
|
|
|
|
|
|
|
|
return $params;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
public function getMessageParameters(){
|
|
|
|
case 'reject':
|
|
|
|
$params = parent::getMessageParameters();
|
|
|
|
$modId = $entryParams['modid'];
|
|
|
|
$entryParams = $this->entry->getParameters();
|
|
|
|
|
|
|
|
$type = $this->entry->getSubtype();
|
|
|
|
|
|
|
|
|
|
|
|
$user = User::newFromId($entryParams['moduser']);
|
|
|
|
switch($type){
|
|
|
|
$userLink = Linker::userLink( $user->getId(), $user->getName() );
|
|
|
|
case 'approve':
|
|
|
|
$params[3] = Message::rawParam( $userLink );
|
|
|
|
$params = $this->buildBaseParams($params);
|
|
|
|
|
|
|
|
|
|
|
|
$link = $linkRenderer->makeKnownLink(
|
|
|
|
break;
|
|
|
|
SpecialPage::getTitleFor( 'Moderation' ),
|
|
|
|
case 'reject':
|
|
|
|
$this->msg( 'moderation-log-change' )->params( $modId )->text(),
|
|
|
|
$params = $this->buildBaseParams($params);
|
|
|
|
[ 'title' => $this->msg( 'tooltip-moderation-rejected-change' )->plain() ],
|
|
|
|
|
|
|
|
[ 'modaction' => 'show', 'modid' => $modId ]
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
$params[4] = Message::rawParam( $link );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$params[5] = Utils::getReadableReason($entryParams['reason']);
|
|
|
|
$params[5] = Utils::getReadableReason($entryParams['reason']);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -55,13 +55,14 @@ class LogFormatter extends GlobalLogFormatter {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function getPreloadTitles() {
|
|
|
|
public function getPreloadTitles() {
|
|
|
|
|
|
|
|
$services = MediaWikiServices::getInstance();
|
|
|
|
$type = $this->entry->getSubtype();
|
|
|
|
$type = $this->entry->getSubtype();
|
|
|
|
$params = $this->entry->getParameters();
|
|
|
|
$params = $this->entry->getParameters();
|
|
|
|
|
|
|
|
|
|
|
|
$titles = [];
|
|
|
|
$titles = [];
|
|
|
|
|
|
|
|
|
|
|
|
if ( $params['moduser'] ) { # Not anonymous
|
|
|
|
if ( $params['moduser'] ) { # Not anonymous
|
|
|
|
$user = User::newFromId($params['moduser']);
|
|
|
|
$user = $services->getUserFactory()->newFromId($params['moduser']);
|
|
|
|
$titles[] = Title::makeTitle( NS_USER, $user->getName() );
|
|
|
|
$titles[] = Title::makeTitle( NS_USER, $user->getName() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|