From e9447a8786cea5410af1af9db043b2890ad90a81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Mon, 21 Nov 2022 13:53:38 +0100 Subject: [PATCH] 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 4835b6b1cb1261f96f067fa68da1f9a4fbbe94c8. Bug: T323491 Change-Id: I5043efc31722d2b9cd2a8dd482594355a761008e --- includes/Special/SpecialNotifications.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/includes/Special/SpecialNotifications.php b/includes/Special/SpecialNotifications.php index 35841f84a..968eb9624 100644 --- a/includes/Special/SpecialNotifications.php +++ b/includes/Special/SpecialNotifications.php @@ -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' );