Merge "Log entries can be rendered with parentheses in HTML"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 20 Sep 2019 00:22:16 +0000 (00:22 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 20 Sep 2019 00:22:16 +0000 (00:22 +0000)
includes/changes/ChangesList.php
includes/changes/OldChangesList.php

index fbcbc35..24b8e41 100644 (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;
+               }
        }
 
        /**
index c15701b..8228bae 100644 (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 {