Assign user before sending notification
authorCyperghost <olaf_schmitz_1@t-online.de>
Wed, 20 Mar 2024 13:16:48 +0000 (14:16 +0100)
committerCyperghost <olaf_schmitz_1@t-online.de>
Wed, 20 Mar 2024 13:16:48 +0000 (14:16 +0100)
wcfsetup/install/files/lib/system/moderation/queue/ModerationQueueReportManager.class.php
wcfsetup/install/files/lib/system/user/notification/event/ReportModerationQueueUserNotificationEvent.class.php

index f8cc759977defaa68446438c09c1bc5b807720cf..77aad36ea218003a4717238f24e68f6cdb633f80 100644 (file)
@@ -256,6 +256,11 @@ class ModerationQueueReportManager extends AbstractModerationQueueManager
         if ($userIDs === []) {
             return;
         }
+        foreach ($userIDs as $userID) {
+            $user = UserProfileRuntimeCache::getInstance()->getObject($userID);
+            ModerationQueueManager::getInstance()->setAssignment([$queue->queueID => 1], $user->getDecoratedObject());
+        }
+
         UserNotificationHandler::getInstance()->fireEvent(
             'report',
             'com.woltlab.wcf.moderation.queue',
index 4d87272ca1d1bd1c71bbf38e418c3908d8c9a981..4ff92bf18706b46aaedb7a509d8a04877945d722 100644 (file)
@@ -27,7 +27,7 @@ final class ReportModerationQueueUserNotificationEvent extends AbstractUserNotif
     use TTestableModerationQueueUserNotificationEvent;
     use TTestableUserNotificationEvent;
 
-    private ViewableModerationQueue $viewableModerationQueue;
+    private ?ViewableModerationQueue $viewableModerationQueue;
     #[\Override]
     public function getTitle(): string
     {
@@ -84,6 +84,9 @@ final class ReportModerationQueueUserNotificationEvent extends AbstractUserNotif
     #[\Override]
     public function checkAccess()
     {
+        if ($this->getViewableModerationQueue() === null) {
+            return false;
+        }
         $objectType = ObjectTypeCache::getInstance()->getObjectType($this->getUserNotificationObject()->objectTypeID);
         $processor = $objectType->getProcessor();
         \assert($processor instanceof IModerationQueueHandler);
@@ -94,7 +97,7 @@ final class ReportModerationQueueUserNotificationEvent extends AbstractUserNotif
         );
     }
 
-    private function getViewableModerationQueue(): ViewableModerationQueue
+    private function getViewableModerationQueue(): ?ViewableModerationQueue
     {
         if (!isset($this->viewableModerationQueue)) {
             $this->viewableModerationQueue = ViewableModerationQueue::getViewableModerationQueue(