Move condition to not show form one level up
authorWMDE-Fisch <christoph.fischer@wikimedia.de>
Wed, 26 Oct 2016 14:43:50 +0000 (16:43 +0200)
committerWMDE-Fisch <christoph.jauera@wikimedia.de>
Thu, 27 Oct 2016 12:34:41 +0000 (12:34 +0000)
This condition to abort the show form process was more or less
hidden in the header method. The returned boolean was used nowhere
else.

Change-Id: I91335deac0547c24d107305a2ded503c9ab15090

includes/EditPage.php

index 4aa87d6..7d1cf1d 100644 (file)
@@ -2620,10 +2620,21 @@ ERROR;
 
                $this->setHeaders();
 
-               if ( $this->showHeader() === false ) {
+               $this->addTalkPageText();
+               $this->addEditNotices();
+
+               if ( !$this->isConflict &&
+                       $this->section != '' &&
+                       !$this->isSectionEditSupported() ) {
+                       // We use $this->section to much before this and getVal('wgSection') directly in other places
+                       // at this point we can't reset $this->section to '' to fallback to non-section editing.
+                       // Someone is welcome to try refactoring though
+                       $wgOut->showErrorPage( 'sectioneditnotsupported-title', 'sectioneditnotsupported-text' );
                        return;
                }
 
+               $this->showHeader();
+
                $wgOut->addHTML( $this->editFormPageTop );
 
                if ( $wgUser->getOption( 'previewontop' ) ) {
@@ -2878,29 +2889,14 @@ ERROR;
                }
        }
 
-       /**
-        * @return bool
-        */
        protected function showHeader() {
                global $wgOut, $wgUser, $wgMaxArticleSize, $wgLang;
                global $wgAllowUserCss, $wgAllowUserJs;
 
-               $this->addTalkPageText();
-
-               $this->addEditNotices();
-
                if ( $this->isConflict ) {
                        $wgOut->wrapWikiMsg( "<div class='mw-explainconflict'>\n$1\n</div>", 'explainconflict' );
                        $this->editRevId = $this->page->getLatest();
                } else {
-                       if ( $this->section != '' && !$this->isSectionEditSupported() ) {
-                               // We use $this->section to much before this and getVal('wgSection') directly in other places
-                               // at this point we can't reset $this->section to '' to fallback to non-section editing.
-                               // Someone is welcome to try refactoring though
-                               $wgOut->showErrorPage( 'sectioneditnotsupported-title', 'sectioneditnotsupported-text' );
-                               return false;
-                       }
-
                        if ( $this->section != '' && $this->section != 'new' ) {
                                if ( !$this->summary && !$this->preview && !$this->diff ) {
                                        $sectionTitle = self::extractSectionTitle( $this->textbox1 ); // FIXME: use Content object
@@ -3087,8 +3083,6 @@ ERROR;
                }
                # Add header copyright warning
                $this->showHeaderCopyrightWarning();
-
-               return true;
        }
 
        /**