Support embedded objects when rendering liked comment (responses)
authorMatthias Schmidt <gravatronics@live.com>
Wed, 9 Jun 2021 13:17:32 +0000 (15:17 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Wed, 9 Jun 2021 13:17:32 +0000 (15:17 +0200)
wcfsetup/install/files/lib/data/comment/LikeableCommentProvider.class.php
wcfsetup/install/files/lib/system/comment/manager/ArticleCommentManager.class.php
wcfsetup/install/files/lib/system/comment/manager/PageCommentManager.class.php
wcfsetup/install/files/lib/system/comment/manager/UserProfileCommentManager.class.php

index 91531512f4d4f0c403166cdcc75de74837d21786..468f8c698d6481f574fdecc4276c349264a6c0e0 100644 (file)
@@ -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 = [];
index 84fa2378d9c80209a8196ebe3da35afb3874b6a5..00ba3fb20cca76a4dadeda88427fb310c63666f1 100644 (file)
@@ -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 = [];
index 46090a0c6668462c70d2ff46b765b9ead699222e..3b9a39bd97b3019ccf332c17401abfa37a767f1c 100644 (file)
@@ -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 = [];
index e67cbb54427f0167d887686c8a745cf52c387188..b2111d38c34b0424b02006f8460257e0ac4452cf 100644 (file)
@@ -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 = [];