action=feedcontributions no longer has one item more than limit
authorumherirrender <umherirrender_de.wp@web.de>
Tue, 31 Dec 2013 16:44:43 +0000 (17:44 +0100)
committerumherirrender <umherirrender_de.wp@web.de>
Tue, 31 Dec 2013 16:44:43 +0000 (17:44 +0100)
The extra one is used for navigation on Special:Contributions, but that
is not needed on the rss feed.

Bug: 57874
Change-Id: Id56b0da7e921df9cbdb09e90611d226bf224804d

RELEASE-NOTES-1.23
includes/api/ApiFeedContributions.php

index a43ab03..d13f9cd 100644 (file)
@@ -92,6 +92,7 @@ production.
   properly for all parameters.
 * ApiQueryBase::titlePartToKey allows an extra parameter that indicates the
   namespace in order to properly capitalize the title part.
+* (bug 57874) action=feedcontributions no longer has one item more than limit.
 
 === Languages updated in 1.23 ===
 
index bf69410..f90ba98 100644 (file)
@@ -87,7 +87,13 @@ class ApiFeedContributions extends ApiBase {
 
                $feedItems = array();
                if ( $pager->getNumRows() > 0 ) {
+                       $count = 0;
+                       $limit = $pager->getLimit();
                        foreach ( $pager->mResult as $row ) {
+                               // ContribsPager selects one more row for navigation, skip that row
+                               if ( ++$count > $limit ) {
+                                       break;
+                               }
                                $feedItems[] = $this->feedItem( $row );
                        }
                }