Support embedded objects when rendering comment (responses) activities
authorMatthias Schmidt <gravatronics@live.com>
Wed, 9 Jun 2021 13:17:56 +0000 (15:17 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Wed, 9 Jun 2021 13:17:56 +0000 (15:17 +0200)
wcfsetup/install/files/lib/system/user/activity/event/ArticleCommentUserActivityEvent.class.php
wcfsetup/install/files/lib/system/user/activity/event/PageCommentUserActivityEvent.class.php
wcfsetup/install/files/lib/system/user/activity/event/ProfileCommentUserActivityEvent.class.php
wcfsetup/install/files/lib/system/user/activity/event/TCommentResponseUserActivityEvent.class.php

index ad9dce97f792f811e2eb48fdb3197a7972f83f50..8bdaefda08b9fb447df5ab70863b48451d096c4f 100644 (file)
@@ -3,7 +3,7 @@
 namespace wcf\system\user\activity\event;
 
 use wcf\data\article\ViewableArticleList;
-use wcf\data\comment\CommentList;
+use wcf\system\cache\runtime\ViewableCommentRuntimeCache;
 use wcf\system\SingletonFactory;
 use wcf\system\WCF;
 
@@ -29,10 +29,7 @@ class ArticleCommentUserActivityEvent extends SingletonFactory implements IUserA
         }
 
         // fetch comments
-        $commentList = new CommentList();
-        $commentList->setObjectIDs($commentIDs);
-        $commentList->readObjects();
-        $comments = $commentList->getObjects();
+        $comments = ViewableCommentRuntimeCache::getInstance()->getObjects($commentIDs);
 
         // fetch articles
         $articleContentIDs = [];
index bf2d513d5fbe01a8080c6b1e80705b51abf7cdd4..7751379e42969820b482960cc821ed8fe1e54c30 100644 (file)
@@ -2,8 +2,8 @@
 
 namespace wcf\system\user\activity\event;
 
-use wcf\data\comment\CommentList;
 use wcf\data\page\PageCache;
+use wcf\system\cache\runtime\ViewableCommentRuntimeCache;
 use wcf\system\SingletonFactory;
 use wcf\system\WCF;
 
@@ -29,10 +29,7 @@ class PageCommentUserActivityEvent extends SingletonFactory implements IUserActi
         }
 
         // fetch comments
-        $commentList = new CommentList();
-        $commentList->setObjectIDs($commentIDs);
-        $commentList->readObjects();
-        $comments = $commentList->getObjects();
+        $comments = ViewableCommentRuntimeCache::getInstance()->getObjects($commentIDs);
 
         // set message
         foreach ($events as $event) {
index acfd2779307c3464fbb415c74c08ea44ee9714a0..69baa360f924650edb4691e97c1f4e718e1c636f 100644 (file)
@@ -2,8 +2,8 @@
 
 namespace wcf\system\user\activity\event;
 
-use wcf\data\comment\CommentList;
 use wcf\system\cache\runtime\UserProfileRuntimeCache;
+use wcf\system\cache\runtime\ViewableCommentRuntimeCache;
 use wcf\system\SingletonFactory;
 use wcf\system\WCF;
 
@@ -32,10 +32,7 @@ class ProfileCommentUserActivityEvent extends SingletonFactory implements IUserA
         }
 
         // fetch comments
-        $commentList = new CommentList();
-        $commentList->setObjectIDs($commentIDs);
-        $commentList->readObjects();
-        $comments = $commentList->getObjects();
+        $comments = ViewableCommentRuntimeCache::getInstance()->getObjects($commentIDs);
 
         // fetch users
         $userIDs = $users = [];
index 896a6f3b57bf3d09829f3ab8c1fd0ab2bab1f96a..fd92338a805e66d7cf7eddf2fdb85866da7b1a02 100644 (file)
@@ -6,9 +6,9 @@ use wcf\data\comment\Comment;
 use wcf\data\comment\response\CommentResponse;
 use wcf\data\user\activity\event\ViewableUserActivityEvent;
 use wcf\data\user\UserProfile;
-use wcf\system\cache\runtime\CommentResponseRuntimeCache;
-use wcf\system\cache\runtime\CommentRuntimeCache;
 use wcf\system\cache\runtime\UserProfileRuntimeCache;
+use wcf\system\cache\runtime\ViewableCommentResponseRuntimeCache;
+use wcf\system\cache\runtime\ViewableCommentRuntimeCache;
 
 /**
  * Provides a method to read the comment response, comment, and user objects related to comment
@@ -58,7 +58,7 @@ trait TCommentResponseUserActivityEvent
             $responseIDs[] = $event->objectID;
         }
 
-        $this->responses = CommentResponseRuntimeCache::getInstance()->getObjects($responseIDs);
+        $this->responses = ViewableCommentResponseRuntimeCache::getInstance()->getObjects($responseIDs);
 
         $commentIDs = [];
         foreach ($this->responses as $response) {
@@ -66,7 +66,7 @@ trait TCommentResponseUserActivityEvent
         }
 
         if (!empty($commentIDs)) {
-            $this->comments = CommentRuntimeCache::getInstance()->getObjects($commentIDs);
+            $this->comments = ViewableCommentRuntimeCache::getInstance()->getObjects($commentIDs);
         }
 
         $userIDs = [];