<?php
namespace wcf\data\user\notification;
use wcf\data\DatabaseObjectEditor;
-use wcf\system\WCF;
+use wcf\system\user\notification\UserNotificationHandler;
/**
* Provides functions to edit user notifications.
/**
* Marks this notification as confirmed.
+ *
+ * @deprecated 5.2 Please use `UserNotificationHandler::markAsConfirmedByIDs()` instead.
*/
public function markAsConfirmed() {
- $this->update([
- 'confirmTime' => TIME_NOW,
- 'mailNotified' => 1
- ]);
-
- // delete notification_to_user assignment (mimic legacy notification system)
- $sql = "DELETE FROM wcf".WCF_N."_user_notification_to_user
- WHERE notificationID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute([$this->notificationID]);
+ UserNotificationHandler::getInstance()->markAsConfirmedByIDs([$this->notificationID]);
}
}
'userProfile' => $userProfile,
'event' => $event
];
+ // @deprecated 5.2 This event exposes incomplete data and should not be used, please use the following events instead.
EventHandler::getInstance()->fireAction($this, 'fireEvent', $parameters);
// find existing notifications
]);
}
WCF::getDB()->commitTransaction();
+
+ $triggerCountParameters = $parameters;
+ $triggerCountParameters['updateTriggerCount'] = $notificationIDs;
+ EventHandler::getInstance()->fireAction($this, 'updateTriggerCount', $parameters);
+ unset($triggerCountParameters);
}
}
// reset notification count
UserStorageHandler::getInstance()->reset(array_keys($recipients), 'userNotificationCount');
+
+ $parameters['notifications'] = $notifications;
+ $parameters['recipients'] = $recipients;
+ EventHandler::getInstance()->fireAction($this, 'createdNotification', $parameters);
}
}
UserStorageHandler::getInstance()->reset(array_unique($userIDs), 'userNotificationCount');
}
+ $parameters = [
+ 'eventIDs' => $eventIDs,
+ 'objectIDs' => $objectIDs,
+ 'objectType' => $objectType,
+ 'userIDs' => $userIDs,
+ ];
+ EventHandler::getInstance()->fireAction($this, 'removeNotifications', $parameters);
+
// delete notifications
$sql = "DELETE FROM wcf".WCF_N."_user_notification
".$conditions;
array_unshift($parameters, TIME_NOW);
$statement->execute($parameters);
+ $parameters = [
+ 'event' => $event,
+ 'eventName' => $eventName,
+ 'objectIDs' => $objectIDs,
+ 'objectType' => $objectType,
+ 'recipientIDs' => $recipientIDs,
+ ];
+ EventHandler::getInstance()->fireAction($this, 'markAsConfirmed', $parameters);
+
// delete notification_to_user assignments (mimic legacy notification system)
$sql = "DELETE FROM wcf".WCF_N."_user_notification_to_user
WHERE notificationID NOT IN (
* Marks a single notification id as confirmed.
*
* @param integer $notificationID
+ * @deprecated 5.2 Please use `UserNotificationHandler::markAsConfirmedByIDs()` instead.
*/
public function markAsConfirmedByID($notificationID) {
$this->markAsConfirmedByIDs([$notificationID]);
array_unshift($parameters, TIME_NOW);
$statement->execute($parameters);
+ $parameters = ['notificationIDs' => $notificationIDs];
+ EventHandler::getInstance()->fireAction($this, 'markAsConfirmedByIDs', $parameters);
+
// delete notification_to_user assignments (mimic legacy notification system)
$sql = "DELETE FROM wcf".WCF_N."_user_notification_to_user
".$conditions;