From: Matthias Schmidt Date: Wed, 9 Jun 2021 13:17:32 +0000 (+0200) Subject: Support embedded objects when rendering liked comment (responses) X-Git-Tag: 5.5.0_Alpha_1~670^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ccb44776fbc527cfc7e90f13b453beb2e64968b6;p=GitHub%2FWoltLab%2FWCF.git Support embedded objects when rendering liked comment (responses) --- diff --git a/wcfsetup/install/files/lib/data/comment/LikeableCommentProvider.class.php b/wcfsetup/install/files/lib/data/comment/LikeableCommentProvider.class.php index 91531512f4..468f8c698d 100644 --- a/wcfsetup/install/files/lib/data/comment/LikeableCommentProvider.class.php +++ b/wcfsetup/install/files/lib/data/comment/LikeableCommentProvider.class.php @@ -5,6 +5,7 @@ namespace wcf\data\comment; use wcf\data\like\ILikeObjectTypeProvider; use wcf\data\like\object\ILikeObject; use wcf\data\object\type\AbstractObjectTypeProvider; +use wcf\system\cache\runtime\ViewableCommentRuntimeCache; use wcf\system\comment\CommentHandler; use wcf\system\like\IViewableLikeProvider; @@ -65,10 +66,7 @@ class LikeableCommentProvider extends AbstractObjectTypeProvider implements } // fetch comments - $commentList = new CommentList(); - $commentList->setObjectIDs($commentIDs); - $commentList->readObjects(); - $comments = $commentList->getObjects(); + $comments = ViewableCommentRuntimeCache::getInstance()->getObjects($commentIDs); // group likes by object type id $likeData = []; diff --git a/wcfsetup/install/files/lib/system/comment/manager/ArticleCommentManager.class.php b/wcfsetup/install/files/lib/system/comment/manager/ArticleCommentManager.class.php index 84fa2378d9..00ba3fb20c 100644 --- a/wcfsetup/install/files/lib/system/comment/manager/ArticleCommentManager.class.php +++ b/wcfsetup/install/files/lib/system/comment/manager/ArticleCommentManager.class.php @@ -5,11 +5,11 @@ namespace wcf\system\comment\manager; use wcf\data\article\ArticleEditor; use wcf\data\article\content\ArticleContent; use wcf\data\article\content\ArticleContentList; -use wcf\data\comment\CommentList; -use wcf\data\comment\response\CommentResponseList; use wcf\data\object\type\ObjectTypeCache; use wcf\system\cache\runtime\UserProfileRuntimeCache; use wcf\system\cache\runtime\ViewableArticleContentRuntimeCache; +use wcf\system\cache\runtime\ViewableCommentResponseRuntimeCache; +use wcf\system\cache\runtime\ViewableCommentRuntimeCache; use wcf\system\like\IViewableLikeProvider; use wcf\system\WCF; @@ -124,10 +124,7 @@ class ArticleCommentManager extends AbstractCommentManager implements IViewableL // fetch response $userIDs = $responses = []; if (!empty($responseIDs)) { - $responseList = new CommentResponseList(); - $responseList->setObjectIDs($responseIDs); - $responseList->readObjects(); - $responses = $responseList->getObjects(); + $responses = ViewableCommentResponseRuntimeCache::getInstance()->getObjects($responseIDs); foreach ($responses as $response) { $commentIDs[] = $response->commentID; @@ -138,10 +135,7 @@ class ArticleCommentManager extends AbstractCommentManager implements IViewableL } // fetch comments - $commentList = new CommentList(); - $commentList->setObjectIDs($commentIDs); - $commentList->readObjects(); - $comments = $commentList->getObjects(); + $comments = ViewableCommentRuntimeCache::getInstance()->getObjects($commentIDs); // fetch users $users = []; diff --git a/wcfsetup/install/files/lib/system/comment/manager/PageCommentManager.class.php b/wcfsetup/install/files/lib/system/comment/manager/PageCommentManager.class.php index 46090a0c66..3b9a39bd97 100644 --- a/wcfsetup/install/files/lib/system/comment/manager/PageCommentManager.class.php +++ b/wcfsetup/install/files/lib/system/comment/manager/PageCommentManager.class.php @@ -2,12 +2,12 @@ namespace wcf\system\comment\manager; -use wcf\data\comment\CommentList; -use wcf\data\comment\response\CommentResponseList; use wcf\data\object\type\ObjectTypeCache; use wcf\data\page\Page; use wcf\data\page\PageList; use wcf\system\cache\runtime\UserProfileRuntimeCache; +use wcf\system\cache\runtime\ViewableCommentResponseRuntimeCache; +use wcf\system\cache\runtime\ViewableCommentRuntimeCache; use wcf\system\like\IViewableLikeProvider; use wcf\system\request\LinkHandler; use wcf\system\WCF; @@ -118,10 +118,7 @@ class PageCommentManager extends AbstractCommentManager implements IViewableLike // fetch response $userIDs = $responses = []; if (!empty($responseIDs)) { - $responseList = new CommentResponseList(); - $responseList->setObjectIDs($responseIDs); - $responseList->readObjects(); - $responses = $responseList->getObjects(); + $responses = ViewableCommentResponseRuntimeCache::getInstance()->getObjects($responseIDs); foreach ($responses as $response) { $commentIDs[] = $response->commentID; @@ -132,10 +129,7 @@ class PageCommentManager extends AbstractCommentManager implements IViewableLike } // fetch comments - $commentList = new CommentList(); - $commentList->setObjectIDs($commentIDs); - $commentList->readObjects(); - $comments = $commentList->getObjects(); + $comments = ViewableCommentRuntimeCache::getInstance()->getObjects($commentIDs); // fetch users $users = []; diff --git a/wcfsetup/install/files/lib/system/comment/manager/UserProfileCommentManager.class.php b/wcfsetup/install/files/lib/system/comment/manager/UserProfileCommentManager.class.php index e67cbb5442..b2111d38c3 100644 --- a/wcfsetup/install/files/lib/system/comment/manager/UserProfileCommentManager.class.php +++ b/wcfsetup/install/files/lib/system/comment/manager/UserProfileCommentManager.class.php @@ -3,12 +3,12 @@ namespace wcf\system\comment\manager; use wcf\data\comment\Comment; -use wcf\data\comment\CommentList; use wcf\data\comment\response\CommentResponse; -use wcf\data\comment\response\CommentResponseList; use wcf\data\object\type\ObjectTypeCache; use wcf\data\user\ignore\UserIgnore; use wcf\system\cache\runtime\UserProfileRuntimeCache; +use wcf\system\cache\runtime\ViewableCommentResponseRuntimeCache; +use wcf\system\cache\runtime\ViewableCommentRuntimeCache; use wcf\system\like\IViewableLikeProvider; use wcf\system\request\LinkHandler; use wcf\system\WCF; @@ -190,10 +190,7 @@ class UserProfileCommentManager extends AbstractCommentManager implements IViewa // fetch response $userIDs = $responses = []; if (!empty($responseIDs)) { - $responseList = new CommentResponseList(); - $responseList->setObjectIDs($responseIDs); - $responseList->readObjects(); - $responses = $responseList->getObjects(); + $responses = ViewableCommentResponseRuntimeCache::getInstance()->getObjects($responseIDs); foreach ($responses as $response) { $commentIDs[] = $response->commentID; @@ -204,10 +201,7 @@ class UserProfileCommentManager extends AbstractCommentManager implements IViewa } // fetch comments - $commentList = new CommentList(); - $commentList->setObjectIDs($commentIDs); - $commentList->readObjects(); - $comments = $commentList->getObjects(); + $comments = ViewableCommentRuntimeCache::getInstance()->getObjects($commentIDs); // fetch users $users = [];