3 namespace wcf\system\user\notification\event;
5 use wcf\data\moderation\queue\ViewableModerationQueue;
6 use wcf\data\object\type\ObjectTypeCache;
7 use wcf\system\moderation\queue\IModerationQueueHandler;
8 use wcf\system\request\LinkHandler;
9 use wcf\system\user\notification\object\ModerationQueueUserNotificationObject;
13 * Notification event for new reports in the moderation queue.
16 * @copyright 2001-2024 WoltLab GmbH
17 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
20 * @method ModerationQueueUserNotificationObject getUserNotificationObject()
22 final class ReportModerationQueueUserNotificationEvent extends AbstractUserNotificationEvent
24 private ViewableModerationQueue $viewableModerationQueue;
26 public function getTitle(): string
28 return $this->getLanguage()->get('wcf.moderation.report.notification.title');
32 public function getMessage()
34 return $this->getLanguage()->getDynamicVariable(
35 'wcf.moderation.report.notification.message',
37 'author' => $this->author,
38 'notification' => $this->notification,
39 'moderationQueue' => $this->getViewableModerationQueue(),
45 public function getEmailMessage($notificationType = 'instant')
51 public function getLink(): string
53 return LinkHandler::getInstance()->getLink('ModerationReport', [
54 'id' => $this->getUserNotificationObject()->queueID,
59 public function getEventHash()
61 return \sha1($this->eventID . '-' . $this->getUserNotificationObject()->queueID);
65 public function checkAccess()
67 $objectType = ObjectTypeCache::getInstance()->getObjectType($this->getUserNotificationObject()->objectTypeID);
68 $processor = $objectType->getProcessor();
69 \assert($processor instanceof IModerationQueueHandler);
71 return $processor->isAffectedUser(
72 $this->getUserNotificationObject()->getDecoratedObject(),
73 WCF::getUser()->userID
77 private function getViewableModerationQueue(): ViewableModerationQueue
79 if (!isset($this->viewableModerationQueue)) {
80 $this->viewableModerationQueue = new ViewableModerationQueue(
81 $this->getUserNotificationObject()->getDecoratedObject()
83 $objectType = ObjectTypeCache::getInstance()->getObjectType(
84 $this->getUserNotificationObject()->objectTypeID
86 $processor = $objectType->getProcessor();
87 \assert($processor instanceof IModerationQueueHandler);
89 $processor->populate([$this->viewableModerationQueue]);
91 return $this->viewableModerationQueue;