From af964fba4a4a1615cc9f697f39a46df44e2f5af5 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 12 Dec 2014 16:07:34 +0100 Subject: [PATCH] Filling up moderation dropdown with outstanding queues --- .../queue/ModerationQueueAction.class.php | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) 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 -- 2.20.1