From 7446361ad4d14bdd4d8074978d51952918fca637 Mon Sep 17 00:00:00 2001 From: marcosbc Date: Sat, 15 Mar 2014 21:16:13 +0100 Subject: [PATCH 01/12] [ticket/12270] Corrent post and topic approval notification message When you submit a post with needed approval (say user A), and then it gets approved by another user (user B), a subscribed user (user C) to that forum would receive a notification indicating: -A has replied to topic 'New Topic' in the forum 'xyz'. The expected result would be: -A has posted a new topic 'New topic' in the forum 'xyz'. This has fixed by adding a TOPIC_ID template variable to mcp_post.html and, in there, depending if the first post is the topic's first post or not, add a input's with name topic_id_list[] or post_id_list[] and then the respective value (TOPIC_ID or POST_ID). PHPBB3-12270 --- phpBB/includes/mcp/mcp_queue.php | 1 + phpBB/styles/prosilver/template/mcp_post.html | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index a71bc997e9..16ec5e14e4 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -316,6 +316,7 @@ class mcp_queue 'POST_IP' => $post_info['poster_ip'], 'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '', 'POST_ID' => $post_info['post_id'], + 'TOPIC_ID' => $post_info['topic_id'], 'S_FIRST_POST' => ($post_info['topic_first_post_id'] == $post_id), 'U_LOOKUP_IP' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $post_info['forum_id'] . '&p=' . $post_id . '&lookup=' . $post_info['poster_ip']) . '#ip' : '', diff --git a/phpBB/styles/prosilver/template/mcp_post.html b/phpBB/styles/prosilver/template/mcp_post.html index 2b4ebec5c8..69e95c46d7 100644 --- a/phpBB/styles/prosilver/template/mcp_post.html +++ b/phpBB/styles/prosilver/template/mcp_post.html @@ -75,8 +75,12 @@

  - + + + + + {S_FORM_TOKEN}

@@ -86,8 +90,12 @@

  - + + + + + {S_FORM_TOKEN}

From 55757ddc65c7be7854b15f41fbce24d2b1ee2cef Mon Sep 17 00:00:00 2001 From: marcosbc Date: Thu, 27 Mar 2014 16:35:10 +0100 Subject: [PATCH 02/12] [ticket/12270] Correct post&topic approval msg, no template changes Following the previous commits, this patch removes the changes done to templates to depend only on code, as suggested by @nickvergessen. All previous modifications have been removed, with another one which checks, in the approve_posts() function, if it is sending a notification for post approval and it is the first one in the topic, send notification indicating that the topic has been approved (and not the post). If not the first post in the topic, do just as before (send a notification about a newly approved post). PHPBB3-12270 --- phpBB/includes/mcp/mcp_queue.php | 11 +++++++++-- phpBB/styles/prosilver/template/mcp_post.html | 4 ---- 2 files changed, 9 insertions(+), 6 deletions(-) mode change 100644 => 100755 phpBB/includes/mcp/mcp_queue.php mode change 100644 => 100755 phpBB/styles/prosilver/template/mcp_post.html diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php old mode 100644 new mode 100755 index 16ec5e14e4..e003f28c30 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -316,7 +316,6 @@ class mcp_queue 'POST_IP' => $post_info['poster_ip'], 'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && request_var('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '', 'POST_ID' => $post_info['post_id'], - 'TOPIC_ID' => $post_info['topic_id'], 'S_FIRST_POST' => ($post_info['topic_first_post_id'] == $post_id), 'U_LOOKUP_IP' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $post_info['forum_id'] . '&p=' . $post_id . '&lookup=' . $post_info['poster_ip']) . '#ip' : '', @@ -579,6 +578,7 @@ class mcp_queue $redirect = reapply_sid($redirect); $success_msg = $post_url = ''; $approve_log = array(); + $topic_approve_log = array(); $s_hidden_fields = build_hidden_fields(array( 'i' => $id, @@ -687,7 +687,14 @@ class mcp_queue continue; } - $phpbb_notifications->add_notifications('approve_post', $post_data); + if ($topic_info[$post_data['topic_id']]['first_post']) + { + $phpbb_notifications->add_notifications('approve_topic', $topic_info[$post_data['topic_id']]); + } + else + { + $phpbb_notifications->add_notifications('approve_post', $post_data); + } } } } diff --git a/phpBB/styles/prosilver/template/mcp_post.html b/phpBB/styles/prosilver/template/mcp_post.html old mode 100644 new mode 100755 index 69e95c46d7..f2feccf25d --- a/phpBB/styles/prosilver/template/mcp_post.html +++ b/phpBB/styles/prosilver/template/mcp_post.html @@ -75,12 +75,8 @@

  - - - - {S_FORM_TOKEN}

From b8477ad3a27658a09b238654047f2f4a339c7760 Mon Sep 17 00:00:00 2001 From: marcosbc Date: Thu, 27 Mar 2014 16:51:51 +0100 Subject: [PATCH 03/12] [ticket/12270] Reverted templates Some lines in the templates were not reverted correctly, so it's done now. PHPBB3-12270 --- phpBB/includes/mcp/mcp_queue.php | 1 - phpBB/styles/prosilver/template/mcp_post.html | 8 ++------ 2 files changed, 2 insertions(+), 7 deletions(-) mode change 100755 => 100644 phpBB/includes/mcp/mcp_queue.php mode change 100755 => 100644 phpBB/styles/prosilver/template/mcp_post.html diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php old mode 100755 new mode 100644 index e003f28c30..23083bfd96 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -578,7 +578,6 @@ class mcp_queue $redirect = reapply_sid($redirect); $success_msg = $post_url = ''; $approve_log = array(); - $topic_approve_log = array(); $s_hidden_fields = build_hidden_fields(array( 'i' => $id, diff --git a/phpBB/styles/prosilver/template/mcp_post.html b/phpBB/styles/prosilver/template/mcp_post.html old mode 100755 new mode 100644 index f2feccf25d..2b4ebec5c8 --- a/phpBB/styles/prosilver/template/mcp_post.html +++ b/phpBB/styles/prosilver/template/mcp_post.html @@ -75,7 +75,7 @@

  - + {S_FORM_TOKEN}

@@ -86,12 +86,8 @@

  - - + - - - {S_FORM_TOKEN}

From 158705cf418fb1c9a063925846bfa58dd64f6ea4 Mon Sep 17 00:00:00 2001 From: marcosbc Date: Thu, 27 Mar 2014 21:31:41 +0100 Subject: [PATCH 04/12] [ticket/12270] Correct notifications for posts/topics now working This patch should finally work correctly: Add the correct notification for post/topic approval without touching templates. This has been done by calling the function approve_topics() inside the approve_posts() function. It's the simplest way for this to work correctly. There may be a call to the DB but other ways (if any), without touching templates, would have been too messy for a function like this. PHPBB3-12270 --- phpBB/includes/mcp/mcp_queue.php | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 23083bfd96..c01d446b84 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(); + $topics_id_list = array(); $s_hidden_fields = build_hidden_fields(array( 'i' => $id, @@ -652,18 +653,26 @@ class mcp_queue // Handle notifications foreach ($post_info as $post_id => $post_data) { - // A single topic approval may also happen here, so handle deleting the respective notification. + $send_topic_notification = false; + + // A single topic approval may also happen here. if (!$post_data['topic_posts_approved']) { - $phpbb_notifications->delete_notifications('topic_in_queue', $post_data['topic_id']); + $send_topic_notification = true; + $topics_id_list[] = $post_data['topic_id']; } $phpbb_notifications->delete_notifications('post_in_queue', $post_id); +<<<<<<< HEAD // 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) +======= + // Send post notification only if a topic notification will not be sent. + if (!$send_topic_notification) +>>>>>>> c3f1f31... [ticket/12270] Correct notifications for posts/topics now working { $phpbb_notifications->add_notifications(array( 'quote', @@ -686,16 +695,11 @@ class mcp_queue continue; } - if ($topic_info[$post_data['topic_id']]['first_post']) - { - $phpbb_notifications->add_notifications('approve_topic', $topic_info[$post_data['topic_id']]); - } - else - { - $phpbb_notifications->add_notifications('approve_post', $post_data); - } + $phpbb_notifications->add_notifications('approve_post', $post_data); } } + + self::approve_topics($action, $topics_id_list, $id, $mode); } meta_refresh(3, $redirect); From f9edc85f823a1dbbbd6efe2c9efe030e643b3bde Mon Sep 17 00:00:00 2001 From: marcosbc Date: Sat, 5 Apr 2014 14:51:50 +0200 Subject: [PATCH 05/12] [ticket/12270] Better structured code and no debug error message A variable (that's not essential) has been removed, two if's has been merged to an if-else control structure. A variable named topic_ids_list has been renamed to topic_id_list to follow the naming standard in that file's code. Also, the debug error has been fixed by changing the topic data key 'username' to 'post_username' in the array_merge function in approve_topics(). PHPBB3-12270 --- phpBB/includes/mcp/mcp_queue.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index c01d446b84..31c41f5bb1 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -578,7 +578,7 @@ class mcp_queue $redirect = reapply_sid($redirect); $success_msg = $post_url = ''; $approve_log = array(); - $topics_id_list = array(); + $topic_id_list = array(); $s_hidden_fields = build_hidden_fields(array( 'i' => $id, @@ -653,14 +653,12 @@ class mcp_queue // Handle notifications foreach ($post_info as $post_id => $post_data) { - $send_topic_notification = false; - // A single topic approval may also happen here. if (!$post_data['topic_posts_approved']) { - $send_topic_notification = true; - $topics_id_list[] = $post_data['topic_id']; + $topic_id_list[] = $post_data['topic_id']; } +<<<<<<< HEAD $phpbb_notifications->delete_notifications('post_in_queue', $post_id); <<<<<<< HEAD @@ -673,6 +671,10 @@ class mcp_queue // Send post notification only if a topic notification will not be sent. if (!$send_topic_notification) >>>>>>> c3f1f31... [ticket/12270] Correct notifications for posts/topics now working +======= + // Send post notification only if a topic notification will not be sent. + else +>>>>>>> a21cc11... [ticket/12270] Better structured code and no debug error message { $phpbb_notifications->add_notifications(array( 'quote', @@ -680,6 +682,7 @@ class mcp_queue 'post', ), $post_data); } + $phpbb_notifications->delete_notifications('post_in_queue', $post_id); $phpbb_notifications->mark_notifications_read(array( 'quote', @@ -699,7 +702,8 @@ class mcp_queue } } - self::approve_topics($action, $topics_id_list, $id, $mode); + if(count($topic_id_list) > 0) + self::approve_topics($action, $topic_id_list, $id, $mode); } meta_refresh(3, $redirect); @@ -845,7 +849,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); From 1fec5e6967f4cc1278aead9959aa0c8f8ac36a56 Mon Sep 17 00:00:00 2001 From: marcosbc Date: Sun, 6 Apr 2014 23:16:23 +0200 Subject: [PATCH 06/12] [ticket/12270] Correcting to follow phpBB coding standards I forgot to put the brackets (so it follows the phpBB coding standards) and changed "count($topic_id_list) > 0" to "!empty($topic_id_list)", making the syntax more comprehensible. PHPBB3-12270 --- phpBB/includes/mcp/mcp_queue.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 31c41f5bb1..fd22a866bb 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -702,8 +702,10 @@ class mcp_queue } } - if(count($topic_id_list) > 0) + if (!empty($topic_id_list)) + { self::approve_topics($action, $topic_id_list, $id, $mode); + } } meta_refresh(3, $redirect); From 46c658bdbf87826b003640da26b613320e91e9ec Mon Sep 17 00:00:00 2001 From: marcosbc Date: Sat, 12 Apr 2014 15:40:56 +0200 Subject: [PATCH 07/12] [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 --- phpBB/includes/mcp/mcp_queue.php | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index fd22a866bb..a3e6e62b07 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -732,20 +732,21 @@ class mcp_queue } else { + $num_topics = 0; $show_notify = false; if ($action == 'approve') { 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; } } } @@ -755,7 +756,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); From deba1329c893507a33a146bac8140f44d6e07e66 Mon Sep 17 00:00:00 2001 From: marcosbc Date: Sat, 3 May 2014 21:05:29 +0200 Subject: [PATCH 08/12] [ticket/12270] Fixed rebase conflicts PHPBB3-12270 --- phpBB/includes/mcp/mcp_queue.php | 35 +++++++++++++------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index a3e6e62b07..c2bcb048b3 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -653,34 +653,27 @@ class mcp_queue // Handle notifications foreach ($post_info as $post_id => $post_data) { - // A single topic approval may also happen here. + // A single topic approval may also happen here, so handle deleting the respective notification. if (!$post_data['topic_posts_approved']) { + $phpbb_notifications->delete_notifications('topic_in_queue', $post_data['topic_id']); $topic_id_list[] = $post_data['topic_id']; } -<<<<<<< HEAD - $phpbb_notifications->delete_notifications('post_in_queue', $post_id); - -<<<<<<< HEAD - // 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) -======= - // Send post notification only if a topic notification will not be sent. - if (!$send_topic_notification) ->>>>>>> c3f1f31... [ticket/12270] Correct notifications for posts/topics now working -======= // Send post notification only if a topic notification will not be sent. else ->>>>>>> a21cc11... [ticket/12270] Better structured code and no debug error message { - $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( + 'quote', + 'bookmark', + 'post', + ), $post_data); + } } $phpbb_notifications->delete_notifications('post_in_queue', $post_id); From 867dc84c335bf959a8763c6dc90f8254f0ae80d8 Mon Sep 17 00:00:00 2001 From: marcosbc Date: Fri, 9 May 2014 01:22:20 +0200 Subject: [PATCH 09/12] [ticket/12270] Fixed tests PHPBB3-12270 --- tests/functional/visibility_reapprove_test.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/functional/visibility_reapprove_test.php b/tests/functional/visibility_reapprove_test.php index 70134ef724..57a1212c57 100644 --- a/tests/functional/visibility_reapprove_test.php +++ b/tests/functional/visibility_reapprove_test.php @@ -208,8 +208,7 @@ class phpbb_functional_visibility_reapprove_test extends phpbb_functional_test_c $crawler = self::submit($form); $form = $crawler->selectButton($this->lang('YES'))->form(); $crawler = self::submit($form); - //@todo $this->assertContainsLang('TOPIC_APPROVED_SUCCESS', $crawler->text()); - $this->assertContainsLang('POST_APPROVED_SUCCESS', $crawler->text()); + $this->assertContainsLang('TOPIC_APPROVED_SUCCESS', $crawler->text()); $this->assert_forum_details($this->data['forums']['Reapprove Test #1'], array( 'forum_posts_approved' => 3, From 984ae598bebb63a4b3ffd55dd94334c2b1b30d6f Mon Sep 17 00:00:00 2001 From: marcosbc Date: Sat, 10 May 2014 16:36:11 +0200 Subject: [PATCH 10/12] [ticket/12270] No quote notif and double poster notification fix Since a call was added to self::approve_topic(), the poster would get double-notified about it (even if it was later marked as read). Also, when creating a new topic with a quote, it would not be notified, this has also been fixed. PHPBB3-12270 --- phpBB/includes/mcp/mcp_queue.php | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index c2bcb048b3..74e11e6990 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -578,7 +578,6 @@ class mcp_queue $redirect = reapply_sid($redirect); $success_msg = $post_url = ''; $approve_log = array(); - $topic_id_list = array(); $s_hidden_fields = build_hidden_fields(array( 'i' => $id, @@ -657,9 +656,12 @@ class mcp_queue if (!$post_data['topic_posts_approved']) { $phpbb_notifications->delete_notifications('topic_in_queue', $post_data['topic_id']); - $topic_id_list[] = $post_data['topic_id']; + + if ($post_data['post_visibility'] == ITEM_UNAPPROVED) + { + $phpbb_notifications->add_notifications(array('topic'), $post_data); + } } - // Send post notification only if a topic notification will not be sent. else { // Only add notifications, if we are not reapproving post @@ -669,12 +671,12 @@ class mcp_queue if ($post_data['post_visibility'] == ITEM_UNAPPROVED) { $phpbb_notifications->add_notifications(array( - 'quote', '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( @@ -691,14 +693,16 @@ 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 (!empty($topic_id_list)) - { - self::approve_topics($action, $topic_id_list, $id, $mode); - } } meta_refresh(3, $redirect); From c47c50a29e675a1ba46a0aab42324ad099589682 Mon Sep 17 00:00:00 2001 From: marcosbc Date: Wed, 21 May 2014 00:25:22 +0200 Subject: [PATCH 11/12] [ticket/12270] Fixed tests not working The success message wasn't output correctly if we were approving topics. PHPBB3-12270 --- phpBB/includes/mcp/mcp_queue.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 74e11e6990..ff230af1e6 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']); @@ -660,6 +656,7 @@ class mcp_queue if ($post_data['post_visibility'] == ITEM_UNAPPROVED) { $phpbb_notifications->add_notifications(array('topic'), $post_data); + $num_topics++; } } else @@ -705,6 +702,15 @@ class mcp_queue } } + 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]; @@ -729,7 +735,6 @@ class mcp_queue } else { - $num_topics = 0; $show_notify = false; if ($action == 'approve') From 36dfb95816d66a14533e2a1913154bde377b100c Mon Sep 17 00:00:00 2001 From: marcosbc Date: Sat, 24 May 2014 14:06:23 +0200 Subject: [PATCH 12/12] [ticket/12270] Fixed topic counting bug and tests Topics was not correctly counted (the counter didn't count topics that were re-approved, for example, but only the ones that were unapproved. This should also fix the test that wasn't working correctly. PHPBB3-12270 --- phpBB/includes/mcp/mcp_queue.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index ff230af1e6..5f96d5952b 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -656,6 +656,9 @@ class mcp_queue if ($post_data['post_visibility'] == ITEM_UNAPPROVED) { $phpbb_notifications->add_notifications(array('topic'), $post_data); + } + if ($post_data['post_visibility'] != ITEM_APPROVED) + { $num_topics++; } }