From: Marcel Werk Date: Wed, 18 Jan 2017 17:34:13 +0000 (+0100) Subject: Merge remote-tracking branch 'refs/remotes/origin/2.1' X-Git-Tag: 3.0.1~13 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c112031f5641e90f2cbb065c034c42b0493e0cb5;p=GitHub%2FWoltLab%2FWCF.git Merge remote-tracking branch 'refs/remotes/origin/2.1' # Conflicts: # wcfsetup/install/files/lib/data/comment/CommentAction.class.php --- c112031f5641e90f2cbb065c034c42b0493e0cb5 diff --cc wcfsetup/install/files/lib/data/comment/CommentAction.class.php index 1fb16333f2,2918c9cbc9..d9c65eab36 --- a/wcfsetup/install/files/lib/data/comment/CommentAction.class.php +++ b/wcfsetup/install/files/lib/data/comment/CommentAction.class.php @@@ -383,65 -355,29 +383,65 @@@ class CommentAction extends AbstractDat } // fire notification event - if (UserNotificationHandler::getInstance()->getObjectTypeID($objectType->objectType.'.response.notification')) { - $notificationObjectType = UserNotificationHandler::getInstance()->getObjectTypeProcessor($objectType->objectType.'.response.notification'); + if (UserNotificationHandler::getInstance()->getObjectTypeID($objectType->objectType.'.response.notification') && UserNotificationHandler::getInstance()->getObjectTypeID($objectType->objectType.'.notification')) { + $notificationObjectType = UserNotificationHandler::getInstance()->getObjectTypeProcessor($objectType->objectType.'.notification'); - $userID = $notificationObjectType->getOwnerID($this->comment->commentID); - $notificationObject = new CommentResponseUserNotificationObject($this->createdResponse); - if ($this->comment->userID != WCF::getUser()->userID) { - UserNotificationHandler::getInstance()->fireEvent('commentResponse', $objectType->objectType.'.response.notification', $notificationObject, array($this->comment->userID), array( - 'commentID' => $this->comment->commentID, - 'objectID' => $this->comment->objectID, - 'objectUserID' => $userID, - 'userID' => $this->comment->userID - )); - } - // notify the container owner - if (UserNotificationHandler::getInstance()->getObjectTypeID($objectType->objectType.'.notification')) { - if ($userID != $this->comment->userID && $userID != WCF::getUser()->userID) { - UserNotificationHandler::getInstance()->fireEvent('commentResponseOwner', $objectType->objectType.'.response.notification', $notificationObject, array($userID), array( - 'commentID' => $this->comment->commentID, - 'objectID' => $this->comment->objectID, - 'objectUserID' => $userID, - 'userID' => $this->comment->userID - )); + if ($notificationObjectType instanceof IMultiRecipientCommentUserNotificationObjectType) { + $recipientIDs = $notificationObjectType->getRecipientIDs($this->comment); + + // make sure that the active user gets no notification + $recipientIDs = array_diff($recipientIDs, [WCF::getUser()->userID]); + + if (!empty($recipientIDs)) { + UserNotificationHandler::getInstance()->fireEvent( + 'commentResponse', + $objectType->objectType . '.response.notification', + $notificationObject, + $recipientIDs, + [ + 'commentID' => $this->comment->commentID, + 'objectID' => $this->comment->objectID, + 'userID' => $this->comment->userID + ] + ); + } + } + else { + /** @var ICommentUserNotificationObjectType $notificationObjectType */ + + $userID = $notificationObjectType->getOwnerID($this->comment->commentID); + + if ($this->comment->userID != WCF::getUser()->userID) { + UserNotificationHandler::getInstance()->fireEvent( + 'commentResponse', + $objectType->objectType . '.response.notification', + $notificationObject, + [$this->comment->userID], + [ + 'commentID' => $this->comment->commentID, + 'objectID' => $this->comment->objectID, + 'objectUserID' => $userID, + 'userID' => $this->comment->userID + ] + ); + } + + // notify the container owner + if (UserNotificationHandler::getInstance()->getObjectTypeID($objectType->objectType.'.notification')) { + if ($userID != $this->comment->userID && $userID != WCF::getUser()->userID) { + UserNotificationHandler::getInstance()->fireEvent( + 'commentResponseOwner', + $objectType->objectType . '.response.notification', + $notificationObject, + [$userID], [ + 'commentID' => $this->comment->commentID, + 'objectID' => $this->comment->objectID, + 'objectUserID' => $userID, + 'userID' => $this->comment->userID + ] + ); + } } } }