From 36ddafd5c85c5ecdb583666078f00217bf0ea89a Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Wed, 9 Jun 2021 15:17:56 +0200 Subject: [PATCH] Support embedded objects when rendering comment (responses) activities --- .../event/ArticleCommentUserActivityEvent.class.php | 7 ++----- .../activity/event/PageCommentUserActivityEvent.class.php | 7 ++----- .../event/ProfileCommentUserActivityEvent.class.php | 7 ++----- .../event/TCommentResponseUserActivityEvent.class.php | 8 ++++---- 4 files changed, 10 insertions(+), 19 deletions(-) diff --git a/wcfsetup/install/files/lib/system/user/activity/event/ArticleCommentUserActivityEvent.class.php b/wcfsetup/install/files/lib/system/user/activity/event/ArticleCommentUserActivityEvent.class.php index ad9dce97f7..8bdaefda08 100644 --- a/wcfsetup/install/files/lib/system/user/activity/event/ArticleCommentUserActivityEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/activity/event/ArticleCommentUserActivityEvent.class.php @@ -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 = []; diff --git a/wcfsetup/install/files/lib/system/user/activity/event/PageCommentUserActivityEvent.class.php b/wcfsetup/install/files/lib/system/user/activity/event/PageCommentUserActivityEvent.class.php index bf2d513d5f..7751379e42 100644 --- a/wcfsetup/install/files/lib/system/user/activity/event/PageCommentUserActivityEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/activity/event/PageCommentUserActivityEvent.class.php @@ -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) { diff --git a/wcfsetup/install/files/lib/system/user/activity/event/ProfileCommentUserActivityEvent.class.php b/wcfsetup/install/files/lib/system/user/activity/event/ProfileCommentUserActivityEvent.class.php index acfd277930..69baa360f9 100644 --- a/wcfsetup/install/files/lib/system/user/activity/event/ProfileCommentUserActivityEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/activity/event/ProfileCommentUserActivityEvent.class.php @@ -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 = []; diff --git a/wcfsetup/install/files/lib/system/user/activity/event/TCommentResponseUserActivityEvent.class.php b/wcfsetup/install/files/lib/system/user/activity/event/TCommentResponseUserActivityEvent.class.php index 896a6f3b57..fd92338a80 100644 --- a/wcfsetup/install/files/lib/system/user/activity/event/TCommentResponseUserActivityEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/activity/event/TCommentResponseUserActivityEvent.class.php @@ -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 = []; -- 2.20.1