From: Matthias Schmidt Date: Sat, 5 Aug 2017 07:28:40 +0000 (+0200) Subject: Update comments counters after comment creation for test notifications X-Git-Tag: 3.1.0_Alpha_1~104 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=99a41d35a304bf802e10a6f285f2f1f424f9d920;p=GitHub%2FWoltLab%2FWCF.git Update comments counters after comment creation for test notifications See #2359 --- diff --git a/wcfsetup/install/files/lib/system/user/notification/event/TTestableCommentResponseUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/TTestableCommentResponseUserNotificationEvent.class.php index 07826f7463..37cb05237f 100644 --- a/wcfsetup/install/files/lib/system/user/notification/event/TTestableCommentResponseUserNotificationEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/event/TTestableCommentResponseUserNotificationEvent.class.php @@ -5,7 +5,9 @@ use wcf\data\comment\response\CommentResponseAction; use wcf\data\comment\Comment; use wcf\data\comment\CommentAction; use wcf\data\comment\CommentEditor; +use wcf\data\object\type\ObjectTypeCache; use wcf\data\user\UserProfile; +use wcf\system\comment\manager\ICommentManager; use wcf\system\user\notification\object\CommentResponseUserNotificationObject; use wcf\system\user\notification\object\IUserNotificationObject; @@ -53,6 +55,10 @@ trait TTestableCommentResponseUserNotificationEvent { ], self::getTestCommentObjectData($recipient, $author)) ]))->executeAction()['returnValues']; + /** @var ICommentManager $commentManager */ + $commentManager = ObjectTypeCache::getInstance()->getObjectType($comment->objectTypeID)->getProcessor(); + $commentManager->updateCounter($comment->objectID, 1); + /** @var CommentResponse $commentResponse */ $commentResponse = (new CommentResponseAction([], 'create', [ 'data' => [ diff --git a/wcfsetup/install/files/lib/system/user/notification/event/TTestableCommentUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/TTestableCommentUserNotificationEvent.class.php index f8b44f38ff..a3701a0649 100644 --- a/wcfsetup/install/files/lib/system/user/notification/event/TTestableCommentUserNotificationEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/event/TTestableCommentUserNotificationEvent.class.php @@ -2,7 +2,9 @@ namespace wcf\system\user\notification\event; use wcf\data\comment\Comment; use wcf\data\comment\CommentAction; +use wcf\data\object\type\ObjectTypeCache; use wcf\data\user\UserProfile; +use wcf\system\comment\manager\ICommentManager; use wcf\system\user\notification\object\CommentUserNotificationObject; use wcf\system\user\notification\object\IUserNotificationObject; @@ -38,7 +40,8 @@ trait TTestableCommentUserNotificationEvent { * @return Comment */ public static function createTestComment(UserProfile $recipient, UserProfile $author) { - return (new CommentAction([], 'create', [ + /** @var Comment $comment */ + $comment = (new CommentAction([], 'create', [ 'data' => array_merge([ 'enableHtml' => 1, 'isDisabled' => 0, @@ -48,6 +51,12 @@ trait TTestableCommentUserNotificationEvent { 'username' => $recipient->username ], self::getTestCommentObjectData($recipient, $author)) ]))->executeAction()['returnValues']; + + /** @var ICommentManager $commentManager */ + $commentManager = ObjectTypeCache::getInstance()->getObjectType($comment->objectTypeID)->getProcessor(); + $commentManager->updateCounter($comment->objectID, 1); + + return $comment; } /**