[ticket/12270] Correct confirm approval message for topics

When clicking on approving a topic's first post in the MCP to
approve the topic itself, the confirm box dialog asks whether
to approve the post or not, instead of asking to approve the
topic.
To achieve this fix, we just need to count the topics to be
approved and check if it's greater than zero.

PHPBB3-12270
This commit is contained in:
marcosbc 2014-04-12 15:40:56 +02:00
parent 1fec5e6967
commit 46c658bdbf

View file

@ -732,20 +732,21 @@ class mcp_queue
} }
else else
{ {
$num_topics = 0;
$show_notify = false; $show_notify = false;
if ($action == 'approve') if ($action == 'approve')
{ {
foreach ($post_info as $post_data) foreach ($post_info as $post_data)
{ {
if ($post_data['poster_id'] == ANONYMOUS) if (!$post_data['topic_posts_approved'])
{ {
continue; $num_topics++;
} }
else
if (!$show_notify && $post_data['poster_id'] != ANONYMOUS)
{ {
$show_notify = true; $show_notify = true;
break;
} }
} }
} }
@ -755,7 +756,18 @@ class mcp_queue
'S_' . strtoupper($action) => true, 'S_' . strtoupper($action) => true,
)); ));
confirm_box(false, strtoupper($action) . '_POST' . ((sizeof($post_id_list) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_approve.html'); // Create the confirm box message
$action_msg = strtoupper($action);
$num_posts = sizeof($post_id_list) - $num_topics;
if ($num_topics > 0 && $num_posts <= 0)
{
$action_msg .= '_TOPIC' . (($num_topics == 1) ? '' : 'S');
}
else
{
$action_msg .= '_POST' . ((sizeof($post_id_list) == 1) ? '' : 'S');
}
confirm_box(false, $action_msg, $s_hidden_fields, 'mcp_approve.html');
} }
redirect($redirect); redirect($redirect);