Merge "Allow users with deleterevision but not deletedhistory to delete revisions"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 14 Oct 2016 14:21:39 +0000 (14:21 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 14 Oct 2016 14:21:39 +0000 (14:21 +0000)
includes/specials/SpecialRevisiondelete.php

index fcd4ab5..dcaff4d 100644 (file)
@@ -106,7 +106,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
        ];
 
        public function __construct() {
-               parent::__construct( 'Revisiondelete', 'deletedhistory' );
+               parent::__construct( 'Revisiondelete', 'deleterevision' );
        }
 
        public function doesWrites() {
@@ -210,17 +210,19 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                        $this->showForm();
                }
 
-               $qc = $this->getLogQueryCond();
-               # Show relevant lines from the deletion log
-               $deleteLogPage = new LogPage( 'delete' );
-               $output->addHTML( "<h2>" . $deleteLogPage->getName()->escaped() . "</h2>\n" );
-               LogEventsList::showLogExtract(
-                       $output,
-                       'delete',
-                       $this->targetObj,
-                       '', /* user */
-                       [ 'lim' => 25, 'conds' => $qc, 'useMaster' => $this->wasSaved ]
-               );
+               if ( $user->isAllowed( 'deletedhistory' ) ) {
+                       $qc = $this->getLogQueryCond();
+                       # Show relevant lines from the deletion log
+                       $deleteLogPage = new LogPage( 'delete' );
+                       $output->addHTML( "<h2>" . $deleteLogPage->getName()->escaped() . "</h2>\n" );
+                       LogEventsList::showLogExtract(
+                               $output,
+                               'delete',
+                               $this->targetObj,
+                               '', /* user */
+                               [ 'lim' => 25, 'conds' => $qc, 'useMaster' => $this->wasSaved ]
+                       );
+               }
                # Show relevant lines from the suppression log
                if ( $user->isAllowed( 'suppressionlog' ) ) {
                        $suppressLogPage = new LogPage( 'suppress' );