From cbb1e0aa3f71383d3daffcf72a8c58ecc6a72f7f Mon Sep 17 00:00:00 2001 From: Cyperghost Date: Wed, 20 Mar 2024 10:59:23 +0100 Subject: [PATCH] Override `isAffectedUser` for comments --- ...entCommentModerationQueueHandler.class.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/wcfsetup/install/files/lib/system/moderation/queue/AbstractCommentCommentModerationQueueHandler.class.php b/wcfsetup/install/files/lib/system/moderation/queue/AbstractCommentCommentModerationQueueHandler.class.php index 866cd9fa2d..edd4f3aadb 100644 --- a/wcfsetup/install/files/lib/system/moderation/queue/AbstractCommentCommentModerationQueueHandler.class.php +++ b/wcfsetup/install/files/lib/system/moderation/queue/AbstractCommentCommentModerationQueueHandler.class.php @@ -9,6 +9,7 @@ use wcf\data\moderation\queue\ModerationQueue; use wcf\data\moderation\queue\ViewableModerationQueue; use wcf\data\object\type\ObjectTypeCache; use wcf\system\cache\runtime\CommentRuntimeCache; +use wcf\system\cache\runtime\UserProfileRuntimeCache; use wcf\system\comment\manager\ICommentManager; use wcf\system\WCF; @@ -167,4 +168,22 @@ class AbstractCommentCommentModerationQueueHandler extends AbstractModerationQue return WCF::getTPL()->fetch('moderationComment'); } + + #[\Override] + public function isAffectedUser(ModerationQueue $queue, $userID) + { + if (!parent::isAffectedUser($queue, $userID)) { + return false; + } + $comment = $this->getComment($queue->objectID); + if ($comment === null) { + return false; + } + + return $this->getCommentManager($comment)->canModerate( + $comment->objectTypeID, + $comment->objectID, + UserProfileRuntimeCache::getInstance()->getObject($userID) + ); + } } -- 2.20.1