mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-27 17:20:40 +00:00
Paginate even if some events are filtered out
When requesting notifications, the 'continue' value used for pagination is only included if there is more notifications than requested. When some are filtered out, there is less notifications and no 'continue' value, which leads to no pagination at all on the special page. Change-Id: I1a13d2a343f4e60489e2a6a0474c97664ed00d46
This commit is contained in:
parent
5b7f24b11e
commit
da0e0e37e0
|
@ -258,6 +258,10 @@ class ApiEchoNotifications extends ApiCrossWikiBase {
|
|||
$notifs = $notifMapper->fetchUnreadByUser( $user, $limit + 1, $continue, $eventTypes, $titles );
|
||||
}
|
||||
|
||||
// compute $canContinue before bundling and rendering so the count
|
||||
// is not affected by filtering
|
||||
$canContinue = count( $notifs ) > $limit;
|
||||
|
||||
if ( $bundle ) {
|
||||
$bundler = new Bundler();
|
||||
$notifs = $bundler->bundle( $notifs );
|
||||
|
@ -272,7 +276,7 @@ class ApiEchoNotifications extends ApiCrossWikiBase {
|
|||
}
|
||||
|
||||
// Generate offset if necessary
|
||||
if ( count( $result['list'] ) > $limit ) {
|
||||
if ( $canContinue ) {
|
||||
$lastItem = array_pop( $result['list'] );
|
||||
// @todo: what to do with this when fetching from multiple wikis?
|
||||
$result['continue'] = $lastItem['timestamp']['utcunix'] . '|' . $lastItem['id'];
|
||||
|
|
Loading…
Reference in a new issue