EBernhardson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/320295

Change subject: [search] Don't show the create link twice on results page
......................................................................

[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
---
M includes/specials/SpecialSearch.php
1 file changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/95/320295/1

diff --git a/includes/specials/SpecialSearch.php 
b/includes/specials/SpecialSearch.php
index 6daf19f..9bea35f 100644
--- a/includes/specials/SpecialSearch.php
+++ b/includes/specials/SpecialSearch.php
@@ -422,7 +422,12 @@
                                $out->addHTML( '<div class="error">' .
                                        $textStatus->getMessage( 'search-error' 
) . '</div>' );
                        } 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( "<p 
class=\"mw-search-nonefound\">\n$1</p>",
                                        [ $hasOtherResults ? 
'search-nonefound-thiswiki' : 'search-nonefound',
                                                        wfEscapeWikiText( $term 
)

-- 
To view, visit https://gerrit.wikimedia.org/r/320295
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifed921207f82cc0d1c1cb621a81127486d4dd03e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <ebernhard...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to