Merge "Log entries can be rendered with parentheses in HTML"

This commit is contained in:
jenkins-bot 2019-09-20 00:22:16 +00:00 committed by Gerrit Code Review
commit 60882bb6b0
2 changed files with 14 additions and 6 deletions

View file

@ -455,13 +455,21 @@ class ChangesList extends ContextSource {
* @param string &$s HTML to update
* @param Title $title
* @param string $logtype
* @param bool $useParentheses (optional) Wrap log entry in parentheses where needed
*/
public function insertLog( &$s, $title, $logtype ) {
public function insertLog( &$s, $title, $logtype, $useParentheses = true ) {
$page = new LogPage( $logtype );
$logname = $page->getName()->setContext( $this->getContext() )->text();
$s .= Html::rawElement( 'span', [
'class' => 'mw-changeslist-links'
], $this->linkRenderer->makeKnownLink( $title, $logname ) );
$link = $this->linkRenderer->makeKnownLink( $title, $logname, [
'class' => $useParentheses ? '' : 'mw-changeslist-links'
] );
if ( $useParentheses ) {
$s .= $this->msg( 'parentheses' )->rawParams(
$link
)->escaped();
} else {
$s .= $link;
}
}
/**

View file

@ -87,7 +87,7 @@ class OldChangesList extends ChangesList {
if ( $rc->mAttribs['rc_log_type'] ) {
$logtitle = SpecialPage::getTitleFor( 'Log', $rc->mAttribs['rc_log_type'] );
$this->insertLog( $html, $logtitle, $rc->mAttribs['rc_log_type'] );
$this->insertLog( $html, $logtitle, $rc->mAttribs['rc_log_type'], false );
$flags = $this->recentChangesFlags( [ 'unpatrolled' => $unpatrolled,
'bot' => $rc->mAttribs['rc_bot'] ], '' );
if ( $flags !== '' ) {
@ -98,7 +98,7 @@ class OldChangesList extends ChangesList {
list( $name, $htmlubpage ) = MediaWikiServices::getInstance()->getSpecialPageFactory()->
resolveAlias( $rc->mAttribs['rc_title'] );
if ( $name == 'Log' ) {
$this->insertLog( $html, $rc->getTitle(), $htmlubpage );
$this->insertLog( $html, $rc->getTitle(), $htmlubpage, false );
}
// Regular entries
} else {