aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/mcp/mcp_queue.php
diff options
context:
space:
mode:
authormarcosbc <marcosbc>2014-03-27 21:31:41 +0100
committermarcosbc <marcosbc>2014-05-03 20:30:51 +0200
commit158705cf418fb1c9a063925846bfa58dd64f6ea4 (patch)
treed4eb2906cde3548b5da7b5d4c4b480189523511f /phpBB/includes/mcp/mcp_queue.php
parentb8477ad3a27658a09b238654047f2f4a339c7760 (diff)
downloadforums-158705cf418fb1c9a063925846bfa58dd64f6ea4.tar
forums-158705cf418fb1c9a063925846bfa58dd64f6ea4.tar.gz
forums-158705cf418fb1c9a063925846bfa58dd64f6ea4.tar.bz2
forums-158705cf418fb1c9a063925846bfa58dd64f6ea4.tar.xz
forums-158705cf418fb1c9a063925846bfa58dd64f6ea4.zip
[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
Diffstat (limited to 'phpBB/includes/mcp/mcp_queue.php')
-rw-r--r--phpBB/includes/mcp/mcp_queue.php24
1 files 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);