Merge "deleteLogFormatter: explicitly declare parsedParametersDeleteLog"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 13 Sep 2019 21:56:35 +0000 (21:56 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 13 Sep 2019 21:56:35 +0000 (21:56 +0000)
1  2 
includes/logging/DeleteLogFormatter.php

@@@ -23,7 -23,6 +23,7 @@@
   * @since 1.22
   */
  
 +use MediaWiki\MediaWikiServices;
  use MediaWiki\Storage\RevisionRecord;
  
  /**
   * @since 1.19
   */
  class DeleteLogFormatter extends LogFormatter {
+       /** @var array|null */
+       private $parsedParametersDeleteLog;
+       /**
+        * @inheritDoc
+        */
        protected function getMessageKey() {
                $key = parent::getMessageKey();
                if ( in_array( $this->entry->getSubtype(), [ 'event', 'revision' ] ) ) {
                return $key;
        }
  
+       /**
+        * @inheritDoc
+        */
        protected function getMessageParameters() {
-               if ( isset( $this->parsedParametersDeleteLog ) ) {
+               if ( $this->parsedParametersDeleteLog !== null ) {
                        return $this->parsedParametersDeleteLog;
                }
  
        public function getActionLinks() {
                $user = $this->context->getUser();
                $linkRenderer = $this->getLinkRenderer();
 -              if ( !$user->isAllowed( 'deletedhistory' )
 +              $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
 +              if ( !$permissionManager->userHasRight( $user, 'deletedhistory' )
                        || $this->entry->isDeleted( LogPage::DELETED_ACTION )
                ) {
                        return '';
                switch ( $this->entry->getSubtype() ) {
                        case 'delete': // Show undelete link
                        case 'delete_redir':
 -                              if ( $user->isAllowed( 'undelete' ) ) {
 +                              if ( $permissionManager->userHasRight( $user, 'undelete' ) ) {
                                        $message = 'undeletelink';
                                } else {
                                        $message = 'undeleteviewlink';