From: Alexander Ebert Date: Thu, 27 Nov 2014 14:48:31 +0000 (+0100) Subject: Fixed unconfirmed notifications showing in the wrong order X-Git-Tag: 2.1.0_Beta_1~143 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1f14e01a82b5f15b1820df3b27514ec57140a8ef;p=GitHub%2FWoltLab%2FWCF.git Fixed unconfirmed notifications showing in the wrong order --- diff --git a/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php b/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php index 30cbc19d57..46889a7e6b 100644 --- a/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php @@ -310,9 +310,6 @@ class UserNotificationHandler extends SingletonFactory { $notifications = array(); if ($notificationCount > 0) { $notifications = $this->fetchNotifications(5, 0, 0); - if (!empty($notifications)) { - $notifications = array_reverse($notifications); - } } $count = count($notifications); @@ -341,9 +338,8 @@ class UserNotificationHandler extends SingletonFactory { $conditions = new PreparedStatementConditionBuilder(); $conditions->add("notification.userID = ?", array(WCF::getUser()->userID)); - $orderBy = 'notification.time DESC'; if ($filterByConfirmed !== null) { - // fetch the oldest, unconfirmed notifications, order will be reversed using PHP + // consider only unconfirmed notifications if ($filterByConfirmed == 0) { $conditions->add("notification.confirmTime = ?", array(0)); } @@ -351,10 +347,6 @@ class UserNotificationHandler extends SingletonFactory { // consider only notifications marked as confirmed in the past 48 hours (86400 = 1 day) $conditions->add("notification.confirmTime >= ?", array(TIME_NOW - (2 * 86400))); } - - if ($filterByConfirmed = 0) { - $orderBy = 'notification.time ASC'; - } } $sql = "SELECT notification.*, notification_event.eventID, object_type.objectType @@ -364,7 +356,7 @@ class UserNotificationHandler extends SingletonFactory { LEFT JOIN wcf".WCF_N."_object_type object_type ON (object_type.objectTypeID = notification_event.objectTypeID) ".$conditions." - ORDER BY ".$orderBy; + ORDER BY notification.time DESC"; $statement = WCF::getDB()->prepareStatement($sql, $limit, $offset); $statement->execute($conditions->getParameters());