namespace wcf\system\user\notification\event;
+use wcf\data\moderation\queue\ModerationQueue;
use wcf\data\moderation\queue\ViewableModerationQueue;
use wcf\data\object\type\ObjectTypeCache;
use wcf\data\user\UserProfile;
*/
public function checkAccess()
{
- if (!WCF::getSession()->getPermission('mod.general.canUseModeration') || $this->getModerationQueue() === null) {
+ if (!WCF::getSession()->getPermission('mod.general.canUseModeration')) {
return false;
}
if (!$this->moderationQueueLoaded) {
$comment = CommentRuntimeCache::getInstance()->getObject($this->getUserNotificationObject()->commentID);
- $this->moderationQueue = ViewableModerationQueue::getViewableModerationQueue($comment->objectID);
+ $this->moderationQueue = new ViewableModerationQueue(new ModerationQueue($comment->objectID));
$this->moderationQueueLoaded = true;
}
namespace wcf\system\user\notification\event;
+use wcf\data\moderation\queue\ModerationQueue;
use wcf\data\moderation\queue\ViewableModerationQueue;
use wcf\data\object\type\ObjectTypeCache;
use wcf\data\user\notification\UserNotification;
*/
public function checkAccess()
{
- if ($this->moderationQueue === null || !WCF::getSession()->getPermission('mod.general.canUseModeration')) {
+ if (!WCF::getSession()->getPermission('mod.general.canUseModeration')) {
return false;
}
) {
parent::setObject($notification, $object, $author, $additionalData);
- // if the active user has no access, $this->moderationQueue is null
- $this->moderationQueue = ViewableModerationQueue::getViewableModerationQueue(
- $this->getUserNotificationObject()->objectID
+ $this->moderationQueue = new ViewableModerationQueue(
+ new ModerationQueue($this->getUserNotificationObject()->objectID)
);
- if ($this->moderationQueue) {
- /** @var IModerationQueueHandler $moderationHandler */
- $moderationHandler = ObjectTypeCache::getInstance()
- ->getObjectType($this->moderationQueue->objectTypeID)
- ->getProcessor();
- $this->languageItemPrefix = $moderationHandler->getCommentNotificationLanguageItemPrefix();
- $this->typeName = $this->getLanguage()->get($moderationHandler->getCommentNotificationTypeNameLanguageItem());
- }
+ /** @var IModerationQueueHandler $moderationHandler */
+ $moderationHandler = ObjectTypeCache::getInstance()
+ ->getObjectType($this->moderationQueue->objectTypeID)
+ ->getProcessor();
+ $this->languageItemPrefix = $moderationHandler->getCommentNotificationLanguageItemPrefix();
+ $this->typeName = $this->getLanguage()->get($moderationHandler->getCommentNotificationTypeNameLanguageItem());
}
/**