Merge "resourceloader: Merge the two ua.match() calls in startup.js"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 20 Aug 2018 18:32:06 +0000 (18:32 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 20 Aug 2018 18:32:06 +0000 (18:32 +0000)
includes/Html.php
includes/actions/InfoAction.php
tests/phpunit/includes/HtmlTest.php

index 32375c1..dba4c67 100644 (file)
@@ -704,7 +704,7 @@ class Html {
         * @return string of HTML representing a box.
         */
        private static function messageBox( $html, $className, $heading = '' ) {
-               if ( $heading ) {
+               if ( $heading !== '' ) {
                        $html = self::element( 'h2', [], $heading ) . $html;
                }
                return self::rawElement( 'div', [ 'class' => $className ], $html );
index dc661aa..11b8bad 100644 (file)
@@ -233,13 +233,14 @@ class InfoAction extends FormlessAction {
                ];
 
                // Is it a redirect? If so, where to?
-               if ( $title->isRedirect() ) {
+               $redirectTarget = $this->page->getRedirectTarget();
+               if ( $redirectTarget !== null ) {
                        $pageInfo['header-basic'][] = [
                                $this->msg( 'pageinfo-redirectsto' ),
-                               $linkRenderer->makeLink( $this->page->getRedirectTarget() ) .
+                               $linkRenderer->makeLink( $redirectTarget ) .
                                $this->msg( 'word-separator' )->escaped() .
                                $this->msg( 'parentheses' )->rawParams( $linkRenderer->makeLink(
-                                       $this->page->getRedirectTarget(),
+                                       $redirectTarget,
                                        $this->msg( 'pageinfo-redirectsto-info' )->text(),
                                        [],
                                        [ 'action' => 'info' ]
index dc32a6f..070a029 100644 (file)
@@ -476,6 +476,10 @@ class HtmlTest extends MediaWikiTestCase {
                        Html::errorBox( 'err', 'heading' ),
                        '<div class="errorbox"><h2>heading</h2>err</div>'
                );
+               $this->assertEquals(
+                       Html::errorBox( 'err', '0' ),
+                       '<div class="errorbox"><h2>0</h2>err</div>'
+               );
        }
 
        /**