Fix issue with invalid links to moderation queue entry links on first request
authorMatthias Schmidt <gravatronics@live.com>
Sat, 22 Oct 2016 07:04:13 +0000 (09:04 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sat, 22 Oct 2016 07:04:13 +0000 (09:04 +0200)
wcfsetup/install/files/lib/form/AbstractModerationForm.class.php

index ed8137e772f7bc23dab3a32fcadecd3350f108bd..a23736ab061760e93be9c4840087ede8d518cc57 100644 (file)
@@ -7,6 +7,7 @@ use wcf\system\comment\CommentHandler;
 use wcf\system\event\EventHandler;
 use wcf\system\exception\IllegalLinkException;
 use wcf\system\exception\PermissionDeniedException;
+use wcf\system\moderation\queue\ModerationQueueManager;
 use wcf\system\request\LinkHandler;
 use wcf\system\user\collapsible\content\UserCollapsibleContentHandler;
 use wcf\system\WCF;
@@ -74,6 +75,14 @@ abstract class AbstractModerationForm extends AbstractForm {
        public function readParameters() {
                parent::readParameters();
                
+               // if the moderation queue entry has been created after the user visited the
+               // site the last time, they have not been assigned to the queue entry yet,
+               // thus `ViewableModerationQueue::getViewableModerationQueue()` will always
+               // return `null`; `ModerationQueueManager::getOutstandingModerationCount()`
+               // internally refreshes the user assignments if necessary so that the
+               // `ViewableModerationQueue::getViewableModerationQueue()` call will be successful
+               ModerationQueueManager::getInstance()->getOutstandingModerationCount();
+               
                if (isset($_REQUEST['id'])) $this->queueID = intval($_REQUEST['id']);
                $this->queue = ViewableModerationQueue::getViewableModerationQueue($this->queueID);
                if ($this->queue === null) {