From dd4a8a5154c2152bbf3d6ec5feb6143cc062bef7 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Tue, 31 Dec 2013 17:44:43 +0100 Subject: [PATCH] action=feedcontributions no longer has one item more than limit 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 | 1 + includes/api/ApiFeedContributions.php | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/RELEASE-NOTES-1.23 b/RELEASE-NOTES-1.23 index a43ab0361f..d13f9cd55e 100644 --- a/RELEASE-NOTES-1.23 +++ b/RELEASE-NOTES-1.23 @@ -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 === diff --git a/includes/api/ApiFeedContributions.php b/includes/api/ApiFeedContributions.php index bf69410356..f90ba988e3 100644 --- a/includes/api/ApiFeedContributions.php +++ b/includes/api/ApiFeedContributions.php @@ -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 ); } } -- 2.20.1