Fix no-JS Special:Notifications only displaying one notification per day

The loop accidentally overwrote the whole array in every iteration.
It's not necessary to define these empty arrays at all: when working
with multi-dimensional arrays, PHP will create them as needed.

Follow-up to 4835b6b1cb.

Bug: T323491
Change-Id: I5043efc31722d2b9cd2a8dd482594355a761008e
This commit is contained in:
Bartosz Dziewoński 2022-11-21 13:53:38 +01:00
parent 35d89af670
commit e9447a8786

View file

@ -95,11 +95,6 @@ class SpecialNotifications extends SpecialPage {
if ( $dateHeader !== $row['timestamp']['date'] ) {
$dateHeader = $row['timestamp']['date'];
}
$notifArray[ $dateHeader ] = [
'unread' => [],
'notices' => []
];
// Collect unread IDs
if ( !isset( $row['read'] ) ) {
$classes[] = 'mw-echo-notification-unread';
@ -166,7 +161,7 @@ class SpecialNotifications extends SpecialPage {
$heading->appendContent( $dateTitle );
// Mark all read button
if ( $data[ 'unread' ] !== [] ) {
if ( isset( $data[ 'unread' ] ) ) {
// tell the UI to show 'unread' notifications only (instead of 'all')
$out->addJsConfigVars( 'wgEchoReadState', 'unread' );