3 namespace wcf\system\user\notification\event;
5 use wcf\data\moderation\queue\ViewableModerationQueue;
6 use wcf\data\object\type\ObjectTypeCache;
7 use wcf\data\user\UserProfile;
8 use wcf\system\email\Email;
9 use wcf\system\moderation\queue\IModerationQueueHandler;
10 use wcf\system\request\LinkHandler;
11 use wcf\system\user\notification\object\ModerationQueueUserNotificationObject;
15 * Notification event for new reports in the moderation queue.
18 * @copyright 2001-2024 WoltLab GmbH
19 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
22 * @method ModerationQueueUserNotificationObject getUserNotificationObject()
24 final class ReportModerationQueueUserNotificationEvent extends AbstractUserNotificationEvent implements
25 ITestableUserNotificationEvent
27 use TTestableModerationQueueUserNotificationEvent;
28 use TTestableUserNotificationEvent;
30 private ViewableModerationQueue $viewableModerationQueue;
32 public function getTitle(): string
34 return $this->getLanguage()->get('wcf.moderation.report.notification.title');
38 public function getMessage()
40 return $this->getLanguage()->getDynamicVariable(
41 'wcf.moderation.report.notification.message',
43 'author' => $this->author,
44 'notification' => $this->notification,
45 'moderationQueue' => $this->getViewableModerationQueue(),
51 public function getEmailMessage($notificationType = 'instant')
54 'message-id' => 'com.woltlab.wcf.moderation.queue.notification/'
55 . $this->getUserNotificationObject()->queueID,
56 'template' => 'email_notification_moderationQueueReport',
57 'application' => 'wcf',
59 '<com.woltlab.wcf.moderation.queue/'
60 . $this->getUserNotificationObject()->queueID . '@' . Email::getHost() . '>',
63 'author' => $this->author,
64 'notification' => $this->notification,
65 'moderationQueue' => $this->getViewableModerationQueue(),
71 public function getLink(): string
73 return LinkHandler::getInstance()->getLink('ModerationReport', [
74 'id' => $this->getUserNotificationObject()->queueID,
79 public function getEventHash()
81 return \sha1($this->eventID . '-' . $this->getUserNotificationObject()->queueID);
85 public function checkAccess()
87 $objectType = ObjectTypeCache::getInstance()->getObjectType($this->getUserNotificationObject()->objectTypeID);
88 $processor = $objectType->getProcessor();
89 \assert($processor instanceof IModerationQueueHandler);
91 return $processor->isAffectedUser(
92 $this->getUserNotificationObject()->getDecoratedObject(),
93 WCF::getUser()->userID
97 private function getViewableModerationQueue(): ViewableModerationQueue
99 if (!isset($this->viewableModerationQueue)) {
100 $this->viewableModerationQueue = ViewableModerationQueue::getViewableModerationQueue(
101 $this->getUserNotificationObject()->queueID
104 return $this->viewableModerationQueue;
108 public static function canBeTriggeredByGuests()
114 public static function getTestObjects(UserProfile $recipient, UserProfile $author)
116 return [new ModerationQueueUserNotificationObject(self::getTestUserModerationQueueEntry($recipient, $author))];