From: Erik Bernhardson Date: Mon, 7 Nov 2016 21:49:09 +0000 (-0800) Subject: [search] Don't show the create link twice on results page X-Git-Tag: 1.31.0-rc.0~4923^2 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=1cf9404ffcae35d0b7542f1248383ca188ad4a5e;p=lhc%2Fweb%2Fwiklou.git [search] Don't show the create link twice on results page Due to how things flow through the rendering if an offset is provided and there are no results, SpecialSearch::showCreateLink gets run twice and the user gets an odd output. Bug: T149269 Change-Id: Ifed921207f82cc0d1c1cb621a81127486d4dd03e --- diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index 6daf19f5c3..ef514c734f 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -422,7 +422,12 @@ class SpecialSearch extends SpecialPage { $out->addHTML( '
' . $textStatus->getMessage( 'search-error' ) . '
' ); } else { - $this->showCreateLink( $title, $num, $titleMatches, $textMatches ); + if ( !$this->offset ) { + // If we have an offset the create link was rendered earlier in this function. + // This class needs a good de-spaghettification, but for now this will + // do the job. + $this->showCreateLink( $title, $num, $titleMatches, $textMatches ); + } $out->wrapWikiMsg( "

\n$1

", [ $hasOtherResults ? 'search-nonefound-thiswiki' : 'search-nonefound', wfEscapeWikiText( $term )