From: Matthias Schmidt Date: Sun, 27 Jan 2019 14:10:30 +0000 (+0100) Subject: Show likes when loading comment (responses) via permalink X-Git-Tag: 3.1.8~13 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=552667fb75856750ef53e704110756b88e95fc58;p=GitHub%2FWoltLab%2FWCF.git Show likes when loading comment (responses) via permalink Close #2836 --- diff --git a/wcfsetup/install/files/lib/data/comment/CommentAction.class.php b/wcfsetup/install/files/lib/data/comment/CommentAction.class.php index cb8e21b818..279b463223 100644 --- a/wcfsetup/install/files/lib/data/comment/CommentAction.class.php +++ b/wcfsetup/install/files/lib/data/comment/CommentAction.class.php @@ -1026,6 +1026,31 @@ class CommentAction extends AbstractDatabaseObjectAction implements IMessageInli 'commentManager' => $this->commentProcessor ]); + // load like data + if (MODULE_LIKE) { + $likeData = []; + $commentObjectType = LikeHandler::getInstance()->getObjectType('com.woltlab.wcf.comment'); + LikeHandler::getInstance()->loadLikeObjects($commentObjectType, [$comment->commentID]); + $likeData['comment'] = LikeHandler::getInstance()->getLikeObjects($commentObjectType); + + $responseIDs = []; + foreach ($comment as $visibleResponse) { + $responseIDs[] = $visibleResponse->responseID; + } + + if ($response !== null) { + $responseIDs[] = $response->responseID; + } + + if (!empty($responseIDs)) { + $responseObjectType = LikeHandler::getInstance()->getObjectType('com.woltlab.wcf.comment.response'); + LikeHandler::getInstance()->loadLikeObjects($responseObjectType, $responseIDs); + $likeData['response'] = LikeHandler::getInstance()->getLikeObjects($responseObjectType); + } + + WCF::getTPL()->assign('likeData', $likeData); + } + $template = WCF::getTPL()->fetch('commentList'); if ($response === null) { return $template;