From 1cf9404ffcae35d0b7542f1248383ca188ad4a5e Mon Sep 17 00:00:00 2001 From: Erik Bernhardson Date: Mon, 7 Nov 2016 13:49:09 -0800 Subject: [PATCH] [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 --- includes/specials/SpecialSearch.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 ) -- 2.20.1