X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fchanges%2FChangesList.php;h=34d73d65053dfb5963159f5de4cc748cc31ac5e3;hp=78078770b2620cbcd6225a25f597b91fbb1ace3d;hb=203f7aba8c4d3279cd9de7cb479f08b80fb1800a;hpb=367bc8f7d19e66dfe2d7a326ccf1fcd3629640b4 diff --git a/includes/changes/ChangesList.php b/includes/changes/ChangesList.php index 78078770b2..34d73d6505 100644 --- a/includes/changes/ChangesList.php +++ b/includes/changes/ChangesList.php @@ -23,7 +23,7 @@ */ use MediaWiki\Linker\LinkRenderer; use MediaWiki\MediaWikiServices; -use MediaWiki\Storage\RevisionRecord; +use MediaWiki\Revision\RevisionRecord; use Wikimedia\Rdbms\IResultWrapper; class ChangesList extends ContextSource { @@ -161,6 +161,7 @@ class ChangesList extends ContextSource { */ private function preCacheMessages() { if ( !isset( $this->message ) ) { + $this->message = []; foreach ( [ 'cur', 'diff', 'hist', 'enhancedrc-history', 'last', 'blocklink', 'history', 'semicolon-separator', 'pipe-separator' ] as $msg @@ -454,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; + } } /** @@ -624,7 +633,7 @@ class ChangesList extends ContextSource { */ public function insertComment( $rc ) { if ( $this->isDeleted( $rc, RevisionRecord::DELETED_COMMENT ) ) { - return ' ' . + return ' ' . $this->msg( 'rev-deleted-comment' )->escaped() . ''; } else { return Linker::commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle(), @@ -716,7 +725,9 @@ class ChangesList extends ContextSource { /** Check for rollback permissions, disallow special pages, and only * show a link on the top-most revision */ - if ( $title->quickUserCan( 'rollback', $this->getUser() ) ) { + if ( MediaWikiServices::getInstance()->getPermissionManager() + ->quickUserCan( 'rollback', $this->getUser(), $title ) + ) { $rev = new Revision( [ 'title' => $title, 'id' => $rc->mAttribs['rc_this_oldid'],