if (UserNotificationHandler::getInstance()->getEvent($objectType->objectType . '.notification', 'comment')) {
$notificationObject = new CommentUserNotificationObject($comment->getDecoratedObject());
$notificationObjectType = UserNotificationHandler::getInstance()->getObjectTypeProcessor($objectType->objectType . '.notification');
- \assert($notificationObjectType instanceof ICommentUserNotificationObjectType);
if ($notificationObjectType instanceof IMultiRecipientCommentUserNotificationObjectType) {
$recipientIDs = $notificationObjectType->getRecipientIDs($comment->getDecoratedObject());
$recipientIDs = [];
}
- $recipientIDs[] = $notificationObjectType->getOwnerID($comment->commentID);
+ if ($notificationObjectType instanceof ICommentUserNotificationObjectType) {
+ $recipientIDs[] = $notificationObjectType->getOwnerID($comment->commentID);
+ }
// make sure that the comment's author gets no notification
$recipientIDs = \array_diff($recipientIDs, [$comment->getUserID()]);
) {
$notificationObject = new CommentResponseUserNotificationObject($response);
$notificationObjectType = UserNotificationHandler::getInstance()->getObjectTypeProcessor($objectType->objectType . '.notification');
- \assert($notificationObjectType instanceof ICommentUserNotificationObjectType);
if ($notificationObjectType instanceof IMultiRecipientCommentUserNotificationObjectType) {
$recipientIDs = $notificationObjectType->getRecipientIDs($comment);
$recipientIDs[] = $comment->userID;
- $userID = $notificationObjectType->getOwnerID($comment->commentID);
+ $userID = 0;
+ if ($notificationObjectType instanceof ICommentUserNotificationObjectType) {
+ $userID = $notificationObjectType->getOwnerID($comment->commentID);
+ }
// make sure that the response's author gets no notification
$recipientIDs = \array_diff($recipientIDs, [$response->getUserID()]);
// notify the container owner
if (UserNotificationHandler::getInstance()->getEvent($objectType->objectType . '.response.notification', 'commentResponseOwner')) {
- if ($userID != $comment->userID && $userID != $response->getUserID()) {
+ if ($userID && $userID != $comment->userID && $userID != $response->getUserID()) {
UserNotificationHandler::getInstance()->fireEvent(
'commentResponseOwner',
$objectType->objectType . '.response.notification',