From e04ca5856ce6e7eaf840f03020cf25945490517a Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 2 Nov 2014 15:38:41 +0100 Subject: [PATCH] Fixed moderation queue not properly handling new states Fixes #1836 --- .../queue/ModerationQueueAction.class.php | 2 +- .../queue/ModerationQueueManager.class.php | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 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 8345d1dba3..ab8ef634fe 100644 --- a/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueAction.class.php +++ b/wcfsetup/install/files/lib/data/moderation/queue/ModerationQueueAction.class.php @@ -104,7 +104,7 @@ class ModerationQueueAction extends AbstractDatabaseObjectAction { $queueList = new ViewableModerationQueueList(); $queueList->getConditionBuilder()->add("moderation_queue.objectTypeID IN (?)", array($objectTypeIDs)); - $queueList->getConditionBuilder()->add("moderation_queue.status <> ?", array(ModerationQueue::STATUS_DONE)); + $queueList->getConditionBuilder()->add("moderation_queue.status IN (?)", array(array(ModerationQueue::STATUS_OUTSTANDING, ModerationQueue::STATUS_PROCESSING))); $queueList->sqlOrderBy = 'moderation_queue.lastChangeTime DESC'; $queueList->sqlLimit = 5; $queueList->loadUserProfiles = true; diff --git a/wcfsetup/install/files/lib/system/moderation/queue/ModerationQueueManager.class.php b/wcfsetup/install/files/lib/system/moderation/queue/ModerationQueueManager.class.php index 27a209096f..4ec7d9dd22 100644 --- a/wcfsetup/install/files/lib/system/moderation/queue/ModerationQueueManager.class.php +++ b/wcfsetup/install/files/lib/system/moderation/queue/ModerationQueueManager.class.php @@ -243,19 +243,18 @@ class ModerationQueueManager extends SingletonFactory { } // count outstanding and assigned queues + $conditions = new PreparedStatementConditionBuilder(); + $conditions->add("moderation_queue_to_user.userID = ?", array(WCF::getUser()->userID)); + $conditions->add("moderation_queue_to_user.isAffected = ?", array(1)); + $conditions->add("moderation_queue.status IN (?)", array(array(ModerationQueue::STATUS_OUTSTANDING, ModerationQueue::STATUS_PROCESSING))); + $sql = "SELECT COUNT(*) AS count FROM wcf".WCF_N."_moderation_queue_to_user moderation_queue_to_user LEFT JOIN wcf".WCF_N."_moderation_queue moderation_queue ON (moderation_queue.queueID = moderation_queue_to_user.queueID) - WHERE moderation_queue_to_user.userID = ? - AND moderation_queue_to_user.isAffected = ? - AND moderation_queue.status <> ?"; + ".$conditions; $statement = WCF::getDB()->prepareStatement($sql); - $statement->execute(array( - WCF::getUser()->userID, - 1, - ModerationQueue::STATUS_DONE - )); + $statement->execute($conditions->getParameters()); $row = $statement->fetchArray(); $count = $row['count']; -- 2.20.1