From 45258036c04dfceb8bfa4ef1f17201717f551e06 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sun, 27 Jul 2014 14:21:18 +0200 Subject: [PATCH] Reset user notification count when removing notifications --- .../UserNotificationHandler.class.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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 a4c6cb69ee..878adb17cb 100644 --- a/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php @@ -614,6 +614,23 @@ class UserNotificationHandler extends SingletonFactory { $conditions->add("eventID IN (?)", array($eventIDs)); $conditions->add("objectID IN (?)", array($objectIDs)); + $sql = "SELECT userID + FROM wcf".WCF_N."_user_notification + ".$conditions; + $statement = WCF::getDB()->prepareStatement($sql); + $statement->execute($conditions->getParameters()); + + $userIDs = array(); + while ($userID = $statement->fetchColumn()) { + $userIDs[] = $userID; + } + + // reset number of notifications + if (!empty($userIDs)) { + UserStorageHandler::getInstance()->reset($userIDs, 'userNotificationCount'); + } + + // delete notifications $sql = "DELETE FROM wcf".WCF_N."_user_notification ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); -- 2.20.1