diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2014-05-26 18:09:54 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2014-05-26 18:09:54 +0200 |
commit | 172b7cfe35a466c4888f008470a491f312fe16d4 (patch) | |
tree | 5013b583c094abb57d4474252e10ad2f31ba5df9 /phpBB | |
parent | 1b73c217f0ba80e448bb3f34ffe8ed082fa5e99f (diff) | |
parent | 36dfb95816d66a14533e2a1913154bde377b100c (diff) | |
download | forums-172b7cfe35a466c4888f008470a491f312fe16d4.tar forums-172b7cfe35a466c4888f008470a491f312fe16d4.tar.gz forums-172b7cfe35a466c4888f008470a491f312fe16d4.tar.bz2 forums-172b7cfe35a466c4888f008470a491f312fe16d4.tar.xz forums-172b7cfe35a466c4888f008470a491f312fe16d4.zip |
Merge pull request #2134 from marcosbc/ticket/12270
[ticket/12270] Current post and topic approval notification message
* marcosbc/ticket/12270:
[ticket/12270] Fixed topic counting bug and tests
[ticket/12270] Fixed tests not working
[ticket/12270] No quote notif and double poster notification fix
[ticket/12270] Fixed tests
[ticket/12270] Fixed rebase conflicts
[ticket/12270] Correct confirm approval message for topics
[ticket/12270] Correcting to follow phpBB coding standards
[ticket/12270] Better structured code and no debug error message
[ticket/12270] Correct notifications for posts/topics now working
[ticket/12270] Reverted templates
[ticket/12270] Correct post&topic approval msg, no template changes
[ticket/12270] Corrent post and topic approval notification message
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/includes/mcp/mcp_queue.php | 82 |
1 files changed, 58 insertions, 24 deletions
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index a71bc997e9..5f96d5952b 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -578,6 +578,7 @@ class mcp_queue $redirect = reapply_sid($redirect); $success_msg = $post_url = ''; $approve_log = array(); + $num_topics = 0; $s_hidden_fields = build_hidden_fields(array( 'i' => $id, @@ -634,11 +635,6 @@ class mcp_queue $phpbb_content_visibility->set_post_visibility(ITEM_APPROVED, $topic_data['posts'], $topic_id, $topic_data['forum_id'], $user->data['user_id'], time(), '', isset($topic_data['first_post']), isset($topic_data['last_post'])); } - if (sizeof($post_info) >= 1) - { - $success_msg = (sizeof($post_info) == 1) ? 'POST_' . strtoupper($action) . 'D_SUCCESS' : 'POSTS_' . strtoupper($action) . 'D_SUCCESS'; - } - foreach ($approve_log as $log_data) { add_log('mod', $log_data['forum_id'], $log_data['topic_id'], 'LOG_POST_' . strtoupper($action) . 'D', $log_data['post_subject']); @@ -656,21 +652,32 @@ class mcp_queue if (!$post_data['topic_posts_approved']) { $phpbb_notifications->delete_notifications('topic_in_queue', $post_data['topic_id']); + + if ($post_data['post_visibility'] == ITEM_UNAPPROVED) + { + $phpbb_notifications->add_notifications(array('topic'), $post_data); + } + if ($post_data['post_visibility'] != ITEM_APPROVED) + { + $num_topics++; + } } - $phpbb_notifications->delete_notifications('post_in_queue', $post_id); - - // Only add notifications, if we are not reapproving post - // When the topic was already approved, but was edited and - // now needs re-approval, we don't want to notify the users - // again. - if ($post_data['post_visibility'] == ITEM_UNAPPROVED) + else { - $phpbb_notifications->add_notifications(array( - 'quote', - 'bookmark', - 'post', - ), $post_data); + // Only add notifications, if we are not reapproving post + // When the topic was already approved, but was edited and + // now needs re-approval, we don't want to notify the users + // again. + if ($post_data['post_visibility'] == ITEM_UNAPPROVED) + { + $phpbb_notifications->add_notifications(array( + 'bookmark', + 'post', + ), $post_data); + } } + $phpbb_notifications->add_notifications(array('quote'), $post_data); + $phpbb_notifications->delete_notifications('post_in_queue', $post_id); $phpbb_notifications->mark_notifications_read(array( 'quote', @@ -686,11 +693,27 @@ class mcp_queue continue; } - $phpbb_notifications->add_notifications('approve_post', $post_data); + if (!$post_data['topic_posts_approved']) + { + $phpbb_notifications->add_notifications('approve_post', $post_data); + } + else + { + $phpbb_notifications->add_notifications('approve_topic', $post_data); + } } } } + if ($num_topics >= 1) + { + $success_msg = ($num_topics == 1) ? 'TOPIC_' . strtoupper($action) . 'D_SUCCESS' : 'TOPICS_' . strtoupper($action) . 'D_SUCCESS'; + } + else + { + $success_msg = (sizeof($post_info) == 1) ? 'POST_' . strtoupper($action) . 'D_SUCCESS' : 'POSTS_' . strtoupper($action) . 'D_SUCCESS'; + } + meta_refresh(3, $redirect); $message = $user->lang[$success_msg]; @@ -721,14 +744,14 @@ class mcp_queue { 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; - break; } } } @@ -738,7 +761,18 @@ class mcp_queue '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); @@ -834,7 +868,7 @@ class mcp_queue 'post_subject' => $topic_data['topic_title'], 'post_time' => $topic_data['topic_time'], 'poster_id' => $topic_data['topic_poster'], - 'username' => $topic_data['topic_first_poster_name'], + 'post_username' => $topic_data['topic_first_poster_name'], )); $phpbb_notifications->delete_notifications('topic_in_queue', $topic_id); |