mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-30 18:45:07 +00:00
Process bundled notifications when the base is filtered out
When the base of a bundle cannot be rendered (canRender() returns false), the bundled items still have to be rendered and potentially marked-as-read as well. If we don't do this, the base is filtered out, marked as read, the counter goes down by 1 and the bundled notifications are ignored. On the next query a new base is selected, filtered out, etc. So if a bundle of 10 notifications cannot be rendered because it's 10 new topics on a deleted flow board, the flyout has to be opened 10 times for the counter to finally be 0. Change-Id: I06962b25e36802ef00278e2bc70d5377b5874695
This commit is contained in:
parent
fa67fc9ea7
commit
a970c44845
|
@ -267,11 +267,16 @@ class ApiEchoNotifications extends ApiCrossWikiBase {
|
|||
$notifs = $bundler->bundle( $notifs );
|
||||
}
|
||||
|
||||
/** @var EchoNotification $notif */
|
||||
foreach ( $notifs as $notif ) {
|
||||
while ( count( $notifs ) ) {
|
||||
/** @var EchoNotification $notif */
|
||||
$notif = array_shift( $notifs );
|
||||
$output = EchoDataOutputFormatter::formatOutput( $notif, $format, $user, $this->getLanguage() );
|
||||
if ( $output !== false ) {
|
||||
$result['list'][] = $output;
|
||||
} elseif ( $bundle && $notif->getBundledNotifications() ) {
|
||||
// when the bundle_base gets filtered out, bundled notifications
|
||||
// have to be re-bundled and formatted
|
||||
$notifs = array_merge( $bundler->bundle( $notif->getBundledNotifications() ), $notifs );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue