From: Alexander Ebert Date: Fri, 12 Dec 2014 15:07:34 +0000 (+0100) Subject: Filling up moderation dropdown with outstanding queues X-Git-Tag: 2.1.0_Beta_1~61 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=af964fba4a4a1615cc9f697f39a46df44e2f5af5;p=GitHub%2FWoltLab%2FWCF.git Filling up moderation dropdown with outstanding queues --- diff --git a/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueAction.class.php b/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueAction.class.php index 692aa708f3..14699045c6 100644 --- a/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueAction.class.php +++ b/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueAction.class.php @@ -134,23 +134,35 @@ class ModerationQueueAction extends AbstractDatabaseObjectAction { $queues = $queueList->getObjects(); } - WCF::getTPL()->assign(array( - 'queues' => $queues - )); - // check if user storage is outdated $totalCount = ModerationQueueManager::getInstance()->getUnreadModerationCount(); $count = count($queues); - if ($count < 5 && $count < $totalCount) { - UserStorageHandler::getInstance()->reset(array(WCF::getUser()->userID), 'outstandingModerationCount'); + if ($count < 5) { + // load more entries to fill up list + $queueList = new ViewableModerationQueueList(); + $queueList->getConditionBuilder()->add("moderation_queue.status IN (?)", array(array(ModerationQueue::STATUS_OUTSTANDING, ModerationQueue::STATUS_PROCESSING))); + $queueList->sqlOrderBy = "moderation_queue.lastChangeTime DESC"; + $queueList->sqlLimit = 5 - $count; + $queueList->loadUserProfiles = true; + $queueList->readObjects(); + $queues = array_merge($queues, $queueList->getObjects()); - // check for orphaned queues - $queueCount = ModerationQueueManager::getInstance()->getUnreadModerationCount(); - if (count($queues) < $queueCount) { - ModerationQueueManager::getInstance()->identifyOrphans(); + // check if stored count is out of sync + if($count < $totalCount) { + UserStorageHandler::getInstance()->reset(array(WCF::getUser()->userID), 'outstandingModerationCount'); + + // check for orphaned queues + $queueCount = ModerationQueueManager::getInstance()->getUnreadModerationCount(); + if (count($queues) < $queueCount) { + ModerationQueueManager::getInstance()->identifyOrphans(); + } } } + WCF::getTPL()->assign(array( + 'queues' => $queues + )); + return array( 'template' => WCF::getTPL()->fetch('moderationQueueList'), 'totalCount' => $totalCount