Add `isAffectedUser` function the comment `AbstractCommentResponseModerationQueueHandler`
authorCyperghost <olaf_schmitz_1@t-online.de>
Fri, 22 Mar 2024 10:33:56 +0000 (11:33 +0100)
committerCyperghost <olaf_schmitz_1@t-online.de>
Fri, 22 Mar 2024 10:33:56 +0000 (11:33 +0100)
wcfsetup/install/files/lib/system/moderation/queue/AbstractCommentResponseModerationQueueHandler.class.php

index 8b0baf16e8bf92788b00a9a0e1c06d769586acd5..d73f24ba8507167bf8a713e52ac5da02d3e4d839 100644 (file)
@@ -10,6 +10,7 @@ use wcf\data\moderation\queue\ModerationQueue;
 use wcf\data\moderation\queue\ViewableModerationQueue;
 use wcf\system\cache\runtime\CommentResponseRuntimeCache;
 use wcf\system\cache\runtime\CommentRuntimeCache;
+use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\database\util\PreparedStatementConditionBuilder;
 use wcf\system\WCF;
 
@@ -163,4 +164,26 @@ class AbstractCommentResponseModerationQueueHandler extends AbstractCommentComme
             $responseAction->executeAction();
         }
     }
+
+    #[\Override]
+    public function isAffectedUser(ModerationQueue $queue, $userID)
+    {
+        if (!parent::isAffectedUser($queue, $userID)) {
+            return false;
+        }
+        $response = $this->getResponse($queue->objectID);
+        if ($response === null) {
+            return false;
+        }
+        $comment = $this->getComment($response->commentID);
+        if ($comment === null) {
+            return false;
+        }
+
+        return $this->getCommentManager($comment)->canModerateObject(
+            $comment->objectTypeID,
+            $comment->objectID,
+            UserProfileRuntimeCache::getInstance()->getObject($userID)
+        );
+    }
 }