Merge "EditPage: Allow summary=0 in URL parameter"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 30 Aug 2018 02:43:59 +0000 (02:43 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 30 Aug 2018 02:43:59 +0000 (02:43 +0000)
1  2 
includes/EditPage.php

diff --combined includes/EditPage.php
@@@ -684,10 -684,7 +684,10 @@@ class EditPage 
                # checking, etc.
                if ( 'initial' == $this->formtype || $this->firsttime ) {
                        if ( $this->initialiseForm() === false ) {
 -                              $this->noSuchSectionPage();
 +                              $out = $this->context->getOutput();
 +                              if ( $out->getRedirect() === '' ) { // mcrundo hack redirects, don't override it
 +                                      $this->noSuchSectionPage();
 +                              }
                                return;
                        }
  
                                $this->sectiontitle = $request->getVal( 'preloadtitle' );
                                // Once wpSummary isn't being use for setting section titles, we should delete this.
                                $this->summary = $request->getVal( 'preloadtitle' );
-                       } elseif ( $this->section != 'new' && $request->getVal( 'summary' ) ) {
+                       } elseif ( $this->section != 'new' && $request->getVal( 'summary' ) !== '' ) {
                                $this->summary = $request->getText( 'summary' );
                                if ( $this->summary !== '' ) {
                                        $this->hasPresetSummary = true;
                                                !$oldrev->isDeleted( Revision::DELETED_TEXT )
                                        ) {
                                                if ( WikiPage::hasDifferencesOutsideMainSlot( $undorev, $oldrev ) ) {
 -                                                      // Cannot yet undo edits that involve anything other the main slot.
 -                                                      $undoMsg = 'main-slot-only';
 +                                                      // Hack for undo while EditPage can't handle multi-slot editing
 +                                                      $this->context->getOutput()->redirect( $this->mTitle->getFullURL( [
 +                                                              'action' => 'mcrundo',
 +                                                              'undo' => $undo,
 +                                                              'undoafter' => $undoafter,
 +                                                      ] ) );
 +                                                      return false;
                                                } else {
                                                        $content = $this->page->getUndoContent( $undorev, $oldrev );
  
@@@ -2869,7 -2861,7 +2869,7 @@@ ERROR
                        $this->autoSumm = md5( '' );
                }
  
-               $autosumm = $this->autoSumm ?: md5( $this->summary );
+               $autosumm = $this->autoSumm !== '' ? $this->autoSumm : md5( $this->summary );
                $out->addHTML( Html::hidden( 'wpAutoSummary', $autosumm ) );
  
                $out->addHTML( Html::hidden( 'oldid', $this->oldid ) );