Yaron Koren has uploaded a new change for review.

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

Change subject: Improved display for "limit=0" - no need for "No results" msg
......................................................................

Improved display for "limit=0" - no need for "No results" msg

Change-Id: Icfcc9be029a070140694a2aaedf2cad38a992fcb
---
M parserfunctions/CargoQuery.php
1 file changed, 11 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Cargo 
refs/changes/78/194878/1

diff --git a/parserfunctions/CargoQuery.php b/parserfunctions/CargoQuery.php
index 110a561..b1dad1d 100644
--- a/parserfunctions/CargoQuery.php
+++ b/parserfunctions/CargoQuery.php
@@ -94,6 +94,13 @@
                        return $parser->insertStripItem( $text, 
$parser->mStripState );
                }
 
+               // If the query limit was set to 0, no need to run the query -
+               // all we need to do is show  the "more results" link, then 
exit.
+               if ( $sqlQuery->mQueryLimit == 0 ) {
+                       $text = $queryDisplayer->viewMoreResultsLink( true );
+                       return $parser->insertStripItem( $text, 
$parser->mStripState );
+               }
+
                try {
                        $queryResults = $sqlQuery->run();
                } catch ( Exception $e ) {
@@ -102,10 +109,10 @@
 
                // Finally, do the display.
                $text = $queryDisplayer->displayQueryResults( $formatter, 
$queryResults );
-               // If there are no results, and the limit was not set to 0,
-               // it's just an automatic message so there's no need for
-               // special parsing.
-               if ( count( $queryResults ) == 0 && $sqlQuery->mQueryLimit > 0 
) {
+               // If there are no results, then - given that we already know
+               // that the limit was not set to 0 - we just need to display an
+               // automatic message, so there's no need for special parsing.
+               if ( count( $queryResults ) == 0 ) {
                        return $text;
                }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icfcc9be029a070140694a2aaedf2cad38a992fcb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Cargo
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to