Fix the inconsistent return value of notifications
authorAlexander Ebert <ebert@woltlab.com>
Mon, 4 Jul 2022 11:19:01 +0000 (13:19 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 4 Jul 2022 11:19:01 +0000 (13:19 +0200)
The API returned a different data structure when there are no notifications to show compared to when there are items. This causes the JS-API to break, because it always expects the later data structure.

This is a regression of ec1a4a80d3a8f89105d6012ec857a7115f41c97e

See https://www.woltlab.com/community/thread/296174-benachrichtigungen-werden-nicht-mehr-angezeigt/

wcfsetup/install/files/lib/data/user/notification/UserNotificationAction.class.php

index f10fa7d6dd76775ec5bb424ecb6b8458bb03de9f..aa2b19fb892b65485cbf152124a5f2d3080e0bb1 100644 (file)
@@ -224,9 +224,6 @@ class UserNotificationAction extends AbstractDatabaseObjectAction
     public function getNotificationData(): array
     {
         $data = UserNotificationHandler::getInstance()->getMixedNotifications();
-        if ($data['count'] === 0) {
-            return [];
-        }
 
         $notifications = [];
         foreach ($data['notifications'] as $notificationData) {