From: Cyperghost Date: Wed, 20 Mar 2024 13:16:48 +0000 (+0100) Subject: Assign user before sending notification X-Git-Tag: 6.1.0_Alpha_1~142^2~22 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0d710ebac96c3941e17bce3d04f5d1421e495fe9;p=GitHub%2FWoltLab%2FWCF.git Assign user before sending notification --- diff --git a/wcfsetup/install/files/lib/system/moderation/queue/ModerationQueueReportManager.class.php b/wcfsetup/install/files/lib/system/moderation/queue/ModerationQueueReportManager.class.php index f8cc759977..77aad36ea2 100644 --- a/wcfsetup/install/files/lib/system/moderation/queue/ModerationQueueReportManager.class.php +++ b/wcfsetup/install/files/lib/system/moderation/queue/ModerationQueueReportManager.class.php @@ -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', diff --git a/wcfsetup/install/files/lib/system/user/notification/event/ReportModerationQueueUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/ReportModerationQueueUserNotificationEvent.class.php index 4d87272ca1..4ff92bf187 100644 --- a/wcfsetup/install/files/lib/system/user/notification/event/ReportModerationQueueUserNotificationEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/event/ReportModerationQueueUserNotificationEvent.class.php @@ -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(