Commit 0924669a by Scott

Update multiple counts in admin

parent cbd6fbda
...@@ -706,6 +706,7 @@ function qa_admin_single_click_array($entityid, $action) ...@@ -706,6 +706,7 @@ function qa_admin_single_click_array($entityid, $action)
case 'approve': case 'approve':
case 'reject': case 'reject':
$entityCount = (int)qa_opt('cache_queuedcount'); $entityCount = (int)qa_opt('cache_queuedcount');
$hiddenCount = (int)qa_opt('cache_hiddencount');
if (!$queued) { if (!$queued) {
$response['result'] = 'error'; $response['result'] = 'error';
$response['error']['type'] = 'post-not-queued'; $response['error']['type'] = 'post-not-queued';
...@@ -726,10 +727,12 @@ function qa_admin_single_click_array($entityid, $action) ...@@ -726,10 +727,12 @@ function qa_admin_single_click_array($entityid, $action)
$response['error']['message'] = qa_lang_html('users/no_permission'); $response['error']['message'] = qa_lang_html('users/no_permission');
$response['error']['severity'] = 'fatal'; $response['error']['severity'] = 'fatal';
} else { } else {
$postStatus = $action === 'approve' if ($action === 'approve') {
? QA_POST_STATUS_NORMAL qa_post_set_status($entityid, QA_POST_STATUS_NORMAL, $userid);
: QA_POST_STATUS_HIDDEN; // 'reject' } else { // 'reject'
qa_post_set_status($entityid, $postStatus, $userid); qa_post_set_status($entityid, QA_POST_STATUS_HIDDEN, $userid);
$hiddenCount++;
}
$response['result'] = 'success'; $response['result'] = 'success';
$response['domUpdates'] = array( $response['domUpdates'] = array(
...@@ -738,6 +741,10 @@ function qa_admin_single_click_array($entityid, $action) ...@@ -738,6 +741,10 @@ function qa_admin_single_click_array($entityid, $action)
'html' => max($entityCount - 1, 0), 'html' => max($entityCount - 1, 0),
), ),
array( array(
'selector' => '.qa-nav-sub-counter-hidden',
'html' => $hiddenCount,
),
array(
'selector' => '#p' . $entityid, 'selector' => '#p' . $entityid,
'action' => 'conceal', 'action' => 'conceal',
), ),
...@@ -791,6 +798,7 @@ function qa_admin_single_click_array($entityid, $action) ...@@ -791,6 +798,7 @@ function qa_admin_single_click_array($entityid, $action)
case 'hide': case 'hide':
case 'clearflags': case 'clearflags':
$entityCount = (int)qa_opt('cache_flaggedcount'); $entityCount = (int)qa_opt('cache_flaggedcount');
$hiddenCount = (int)qa_opt('cache_hiddencount');
if ($action === 'hide' && $queued) { if ($action === 'hide' && $queued) {
$response['result'] = 'error'; $response['result'] = 'error';
$response['error']['type'] = 'post-queued'; $response['error']['type'] = 'post-queued';
...@@ -813,9 +821,9 @@ function qa_admin_single_click_array($entityid, $action) ...@@ -813,9 +821,9 @@ function qa_admin_single_click_array($entityid, $action)
} else { } else {
if ($action === 'hide') { if ($action === 'hide') {
qa_post_set_status($entityid, QA_POST_STATUS_HIDDEN, $userid); qa_post_set_status($entityid, QA_POST_STATUS_HIDDEN, $userid);
$hiddenCount++;
} else { // 'clearflags' } else { // 'clearflags'
require_once QA_INCLUDE_DIR . 'app/votes.php'; require_once QA_INCLUDE_DIR . 'app/votes.php';
qa_flags_clear_all($post, $userid, qa_get_logged_in_handle(), null); qa_flags_clear_all($post, $userid, qa_get_logged_in_handle(), null);
} }
...@@ -826,6 +834,10 @@ function qa_admin_single_click_array($entityid, $action) ...@@ -826,6 +834,10 @@ function qa_admin_single_click_array($entityid, $action)
'html' => max($entityCount - 1, 0), 'html' => max($entityCount - 1, 0),
), ),
array( array(
'selector' => '.qa-nav-sub-counter-hidden',
'html' => $hiddenCount,
),
array(
'selector' => '#p' . $entityid, 'selector' => '#p' . $entityid,
'action' => 'conceal', 'action' => 'conceal',
), ),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment