From 74e2a8f893a2e7a69ba129a74dd0b3c31e742e79 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sun, 9 Sep 2012 13:29:47 -0500 Subject: [ticket/11103] Post notifications PHPBB3-11103 --- phpBB/includes/mcp/mcp_queue.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/mcp/mcp_queue.php') diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index b44685b8a3..d5c431e478 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -421,7 +421,7 @@ class mcp_queue $base_url = $this->u_action . "&f=$forum_id&st=$sort_days&sk=$sort_key&sd=$sort_dir"; phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total, $config['topics_per_page'], $start); - + // Now display the page $template->assign_vars(array( 'L_DISPLAY_ITEMS' => ($mode == 'unapproved_posts') ? $user->lang['DISPLAY_POSTS'] : $user->lang['DISPLAY_TOPICS'], @@ -639,12 +639,12 @@ function approve_post($post_id_list, $id, $mode) if ($post_id == $post_data['topic_first_post_id'] && $post_id == $post_data['topic_last_post_id']) { // Forum Notifications - user_notification('post', $post_data['topic_title'], $post_data['topic_title'], $post_data['forum_name'], $post_data['forum_id'], $post_data['topic_id'], $post_id); + $notifications->add_notifications('topic', $post_data); } else { // Topic Notifications - user_notification('reply', $post_data['post_subject'], $post_data['topic_title'], $post_data['forum_name'], $post_data['forum_id'], $post_data['topic_id'], $post_id); + $notifications->add_notifications('post', $post_data); } } -- cgit v1.2.1 From 5502f3c4aa30ce72131f2a55bcfa3db7a4059427 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sun, 9 Sep 2012 17:20:39 -0500 Subject: [ticket/11103] Restyle the notification list Very rough (lots of inline CSS, very ugly) PHPBB3-11103 --- phpBB/includes/mcp/mcp_queue.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/mcp/mcp_queue.php') diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index d5c431e478..1d9a2dfedc 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -451,7 +451,7 @@ function approve_post($post_id_list, $id, $mode) { global $db, $template, $user, $config; global $phpEx, $phpbb_root_path; - global $request; + global $request, $phpbb_container; if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve'))) { @@ -634,6 +634,8 @@ function approve_post($post_id_list, $id, $mode) // Send out normal user notifications $email_sig = str_replace('
', "\n", "-- \n" . $config['board_email_sig']); + $notifications = $phpbb_container->get('notifications'); + foreach ($post_info as $post_id => $post_data) { if ($post_id == $post_data['topic_first_post_id'] && $post_id == $post_data['topic_last_post_id']) -- cgit v1.2.1 From ed1ec8e720a7ec3c1270cd631cc37e531f315f26 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Fri, 14 Sep 2012 16:54:20 -0500 Subject: [ticket/11103] Add/Update/Mark Read functions accept an array for the type This saves a lot of code in some areas (where the same data is sent, just for different types) Notifications for bookmarks PHPBB3-11103 --- phpBB/includes/mcp/mcp_queue.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/mcp/mcp_queue.php') diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 1d9a2dfedc..48557192d2 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -646,7 +646,7 @@ function approve_post($post_id_list, $id, $mode) else { // Topic Notifications - $notifications->add_notifications('post', $post_data); + $notifications->add_notifications(array('quote', 'bookmark', 'post'), $post_data); } } -- cgit v1.2.1 From 8e977544fb6763412e45f84791de8c3eccf321c9 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Fri, 14 Sep 2012 17:01:08 -0500 Subject: [ticket/11103] Normalization of $phpbb_notifications variable name Use $phpbb_notifications instead of $notifications everywhere for consistency and conflict prevention. PHPBB3-11103 --- phpBB/includes/mcp/mcp_queue.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/mcp/mcp_queue.php') diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 48557192d2..1373829ecf 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -634,19 +634,19 @@ function approve_post($post_id_list, $id, $mode) // Send out normal user notifications $email_sig = str_replace('
', "\n", "-- \n" . $config['board_email_sig']); - $notifications = $phpbb_container->get('notifications'); + $phpbb_notifications = $phpbb_container->get('notifications'); foreach ($post_info as $post_id => $post_data) { if ($post_id == $post_data['topic_first_post_id'] && $post_id == $post_data['topic_last_post_id']) { // Forum Notifications - $notifications->add_notifications('topic', $post_data); + $phpbb_notifications->add_notifications('topic', $post_data); } else { // Topic Notifications - $notifications->add_notifications(array('quote', 'bookmark', 'post'), $post_data); + $phpbb_notifications->add_notifications(array('quote', 'bookmark', 'post'), $post_data); } } -- cgit v1.2.1 From 9c54465a1331216be1e3369346921dee9148e590 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sat, 15 Sep 2012 12:00:03 -0500 Subject: [ticket/11103] Starting approve_post type notification PHPBB3-11103 --- phpBB/includes/mcp/mcp_queue.php | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) (limited to 'phpBB/includes/mcp/mcp_queue.php') diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 1373829ecf..df99e34576 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -597,45 +597,28 @@ function approve_post($post_id_list, $id, $mode) sync('forum', 'forum_id', array_keys($forum_id_list), true, true); unset($topic_id_list, $forum_id_list); - $messenger = new messenger(); + $phpbb_notifications = $phpbb_container->get('notifications'); // Notify Poster? if ($notify_poster) { + // Forum Notifications foreach ($post_info as $post_id => $post_data) { - if ($post_data['poster_id'] == ANONYMOUS) + if ($post_data['post_id'] == $post_data['topic_first_post_id'] && $post_data['post_id'] == $post_data['topic_last_post_id']) { - continue; + $phpbb_notifications->add_notifications('approve_topic', $post_data); + } + else + { + $phpbb_notifications->add_notifications('approve_post', $post_data); } - - $email_template = ($post_data['post_id'] == $post_data['topic_first_post_id'] && $post_data['post_id'] == $post_data['topic_last_post_id']) ? 'topic_approved' : 'post_approved'; - - $messenger->template($email_template, $post_data['user_lang']); - - $messenger->to($post_data['user_email'], $post_data['username']); - $messenger->im($post_data['user_jabber'], $post_data['username']); - - $messenger->assign_vars(array( - 'USERNAME' => htmlspecialchars_decode($post_data['username']), - 'POST_SUBJECT' => htmlspecialchars_decode(censor_text($post_data['post_subject'])), - 'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($post_data['topic_title'])), - - 'U_VIEW_TOPIC' => generate_board_url() . "/viewtopic.$phpEx?f={$post_data['forum_id']}&t={$post_data['topic_id']}&e=0", - 'U_VIEW_POST' => generate_board_url() . "/viewtopic.$phpEx?f={$post_data['forum_id']}&t={$post_data['topic_id']}&p=$post_id&e=$post_id") - ); - - $messenger->send($post_data['user_notify_type']); } } - $messenger->save_queue(); - // Send out normal user notifications $email_sig = str_replace('
', "\n", "-- \n" . $config['board_email_sig']); - $phpbb_notifications = $phpbb_container->get('notifications'); - foreach ($post_info as $post_id => $post_data) { if ($post_id == $post_data['topic_first_post_id'] && $post_id == $post_data['topic_last_post_id']) -- cgit v1.2.1 From 05b573ebf76c737f89deaefd22ce963aa910e5d1 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sat, 15 Sep 2012 13:51:02 -0500 Subject: [ticket/11103] Topic and post dis/approval notifications Remove the formatted title function, plaintext is not needed since email templates are used Fix a number of bugs. PHPBB3-11103 --- phpBB/includes/mcp/mcp_queue.php | 82 ++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 46 deletions(-) (limited to 'phpBB/includes/mcp/mcp_queue.php') diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index df99e34576..bd2092e4bb 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -597,39 +597,34 @@ function approve_post($post_id_list, $id, $mode) sync('forum', 'forum_id', array_keys($forum_id_list), true, true); unset($topic_id_list, $forum_id_list); - $phpbb_notifications = $phpbb_container->get('notifications'); - - // Notify Poster? - if ($notify_poster) - { - // Forum Notifications - foreach ($post_info as $post_id => $post_data) - { - if ($post_data['post_id'] == $post_data['topic_first_post_id'] && $post_data['post_id'] == $post_data['topic_last_post_id']) - { - $phpbb_notifications->add_notifications('approve_topic', $post_data); - } - else - { - $phpbb_notifications->add_notifications('approve_post', $post_data); - } - } - } - // Send out normal user notifications $email_sig = str_replace('
', "\n", "-- \n" . $config['board_email_sig']); + // Handle notifications + $phpbb_notifications = $phpbb_container->get('notifications'); foreach ($post_info as $post_id => $post_data) { if ($post_id == $post_data['topic_first_post_id'] && $post_id == $post_data['topic_last_post_id']) { // Forum Notifications $phpbb_notifications->add_notifications('topic', $post_data); + + // Notify poster? + if ($notify_poster) + { + $phpbb_notifications->add_notifications('approve_topic', $post_data); + } } else { // Topic Notifications $phpbb_notifications->add_notifications(array('quote', 'bookmark', 'post'), $post_data); + + // Notify poster? + if ($notify_poster) + { + $phpbb_notifications->add_notifications('approve_post', $post_data); + } } } @@ -719,7 +714,7 @@ function disapprove_post($post_id_list, $id, $mode) { global $db, $template, $user, $config; global $phpEx, $phpbb_root_path; - global $request; + global $request, $phpbb_container; if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve'))) { @@ -852,20 +847,16 @@ function disapprove_post($post_id_list, $id, $mode) } } - $messenger = new messenger(); - // Notify Poster? if ($notify_poster) { $lang_reasons = array(); + // Handle notifications + $phpbb_notifications = $phpbb_container->get('notifications'); foreach ($post_info as $post_id => $post_data) { - if ($post_data['poster_id'] == ANONYMOUS) - { - continue; - } - + $post_data['disapprove_reason'] = ''; if (isset($disapprove_reason_lang)) { // Okay we need to get the reason from the posters language @@ -891,33 +882,32 @@ function disapprove_post($post_id_list, $id, $mode) } } - $email_disapprove_reason = $lang_reasons[$post_data['user_lang']]; - $email_disapprove_reason .= ($reason) ? "\n\n" . $reason : ''; + $post_data['disapprove_reason'] = $lang_reasons[$post_data['user_lang']]; + $post_data['disapprove_reason'] .= ($reason) ? "\n\n" . $reason : ''; } - $email_template = ($post_data['post_id'] == $post_data['topic_first_post_id'] && $post_data['post_id'] == $post_data['topic_last_post_id']) ? 'topic_disapproved' : 'post_disapproved'; - - $messenger->template($email_template, $post_data['user_lang']); - - $messenger->to($post_data['user_email'], $post_data['username']); - $messenger->im($post_data['user_jabber'], $post_data['username']); - - $messenger->assign_vars(array( - 'USERNAME' => htmlspecialchars_decode($post_data['username']), - 'REASON' => htmlspecialchars_decode($email_disapprove_reason), - 'POST_SUBJECT' => htmlspecialchars_decode(censor_text($post_data['post_subject'])), - 'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($post_data['topic_title']))) - ); - - $messenger->send($post_data['user_notify_type']); + if ($post_id == $post_data['topic_first_post_id'] && $post_id == $post_data['topic_last_post_id']) + { + // Notify poster? + if ($notify_poster) + { + $phpbb_notifications->add_notifications('disapprove_topic', $post_data); + } + } + else + { + // Notify poster? + if ($notify_poster) + { + $phpbb_notifications->add_notifications('disapprove_post', $post_data); + } + } } unset($lang_reasons); } unset($post_info, $disapprove_reason, $email_disapprove_reason, $disapprove_reason_lang); - $messenger->save_queue(); - if ($num_disapproved_topics) { $success_msg = ($num_disapproved_topics == 1) ? 'TOPIC_DISAPPROVED_SUCCESS' : 'TOPICS_DISAPPROVED_SUCCESS'; -- cgit v1.2.1 From 7454d5c2d526f237bf24825b80edf6c9f1750fc6 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sat, 15 Sep 2012 14:33:15 -0500 Subject: [ticket/11103] Topic/Post in queue notification Also, bug fixes and cleanup PHPBB3-11103 --- phpBB/includes/mcp/mcp_queue.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/mcp/mcp_queue.php') diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index bd2092e4bb..1d2caa38d5 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -606,6 +606,9 @@ function approve_post($post_id_list, $id, $mode) { if ($post_id == $post_data['topic_first_post_id'] && $post_id == $post_data['topic_last_post_id']) { + // Delete topic in queue notifications + $phpbb_notifications->delete_notifications(array('topic_in_queue'), $post_data['topic_id']); + // Forum Notifications $phpbb_notifications->add_notifications('topic', $post_data); @@ -617,6 +620,9 @@ function approve_post($post_id_list, $id, $mode) } else { + // Delete post in queue notification + $phpbb_notifications->delete_notifications(array('post_in_queue'), $post_id); + // Topic Notifications $phpbb_notifications->add_notifications(array('quote', 'bookmark', 'post'), $post_data); @@ -847,13 +853,26 @@ function disapprove_post($post_id_list, $id, $mode) } } + // Handle notifications (topic/post in queue) + $phpbb_notifications = $phpbb_container->get('notifications'); + foreach ($post_info as $post_id => $post_data) + { + if ($post_id == $post_data['topic_first_post_id'] && $post_id == $post_data['topic_last_post_id']) + { + $phpbb_notifications->delete_notifications(array('topic_in_queue'), $post_data['topic_id']); + } + else + { + $phpbb_notifications->delete_notifications(array('post_in_queue'), $post_id); + } + } + // Notify Poster? if ($notify_poster) { $lang_reasons = array(); // Handle notifications - $phpbb_notifications = $phpbb_container->get('notifications'); foreach ($post_info as $post_id => $post_data) { $post_data['disapprove_reason'] = ''; -- cgit v1.2.1 From b9bc65eed88bbd2dff12102909903cbf4dc9b368 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 4 Oct 2012 14:47:13 -0500 Subject: [ticket/11103] Make $phpbb_notifications a global and use it everywhere Do not use phpbb_container everywhere (makes testing difficult) PHPBB3-11103 --- phpBB/includes/mcp/mcp_queue.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'phpBB/includes/mcp/mcp_queue.php') diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 1d2caa38d5..77e778fc38 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -451,7 +451,7 @@ function approve_post($post_id_list, $id, $mode) { global $db, $template, $user, $config; global $phpEx, $phpbb_root_path; - global $request, $phpbb_container; + global $request, $phpbb_notifications; if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve'))) { @@ -601,7 +601,6 @@ function approve_post($post_id_list, $id, $mode) $email_sig = str_replace('
', "\n", "-- \n" . $config['board_email_sig']); // Handle notifications - $phpbb_notifications = $phpbb_container->get('notifications'); foreach ($post_info as $post_id => $post_data) { if ($post_id == $post_data['topic_first_post_id'] && $post_id == $post_data['topic_last_post_id']) @@ -720,7 +719,7 @@ function disapprove_post($post_id_list, $id, $mode) { global $db, $template, $user, $config; global $phpEx, $phpbb_root_path; - global $request, $phpbb_container; + global $request, $phpbb_notifications; if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve'))) { @@ -854,7 +853,6 @@ function disapprove_post($post_id_list, $id, $mode) } // Handle notifications (topic/post in queue) - $phpbb_notifications = $phpbb_container->get('notifications'); foreach ($post_info as $post_id => $post_data) { if ($post_id == $post_data['topic_first_post_id'] && $post_id == $post_data['topic_last_post_id']) -- cgit v1.2.1 From 3d79ce28031b4c85ee34bd4d43f0c64b18b1a80b Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Fri, 12 Oct 2012 16:54:42 -0500 Subject: [ticket/11103] Ability to query data before running create_insert_array() Mark post/topic in queue notifications read when visiting mcp Change post/topic in queue notification url to use MCP. Fix the bug: Approving a topic marks the topic as read, but before the notification is created for the user approving the topic (if they would get a notification that the topic has been made). This causes it to be stuck "unread". PHPBB3-11103 --- phpBB/includes/mcp/mcp_queue.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'phpBB/includes/mcp/mcp_queue.php') diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 77e778fc38..b23e5f4e45 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -34,6 +34,7 @@ class mcp_queue { global $auth, $db, $user, $template, $cache; global $config, $phpbb_root_path, $phpEx, $action; + global $phpbb_notifications; include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); @@ -84,6 +85,9 @@ class mcp_queue if (isset($topic_info[$topic_id]['topic_first_post_id'])) { $post_id = (int) $topic_info[$topic_id]['topic_first_post_id']; + + // Mark the notification as read + $phpbb_notifications->mark_notifications_read('topic_in_queue', $topic_id, $user->data['user_id']); } else { @@ -91,6 +95,9 @@ class mcp_queue } } + // Mark the notification as read + $phpbb_notifications->mark_notifications_read('post_in_queue', $post_id, $user->data['user_id']); + $post_info = get_post_data(array($post_id), 'm_approve', true); if (!sizeof($post_info)) -- cgit v1.2.1 From ae670cc87df197e44b768667b853e1dae3009b4d Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 18 Oct 2012 18:32:13 -0500 Subject: [ticket/11103] Remove unnecessary comments Comments that are not needed because the actions are completely self-explanatory PHPBB3-11103 --- phpBB/includes/mcp/mcp_queue.php | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'phpBB/includes/mcp/mcp_queue.php') diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index b23e5f4e45..72f1c00c72 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -86,7 +86,6 @@ class mcp_queue { $post_id = (int) $topic_info[$topic_id]['topic_first_post_id']; - // Mark the notification as read $phpbb_notifications->mark_notifications_read('topic_in_queue', $topic_id, $user->data['user_id']); } else @@ -95,7 +94,6 @@ class mcp_queue } } - // Mark the notification as read $phpbb_notifications->mark_notifications_read('post_in_queue', $post_id, $user->data['user_id']); $post_info = get_post_data(array($post_id), 'm_approve', true); @@ -612,13 +610,10 @@ function approve_post($post_id_list, $id, $mode) { if ($post_id == $post_data['topic_first_post_id'] && $post_id == $post_data['topic_last_post_id']) { - // Delete topic in queue notifications $phpbb_notifications->delete_notifications(array('topic_in_queue'), $post_data['topic_id']); - // Forum Notifications $phpbb_notifications->add_notifications('topic', $post_data); - // Notify poster? if ($notify_poster) { $phpbb_notifications->add_notifications('approve_topic', $post_data); @@ -626,13 +621,10 @@ function approve_post($post_id_list, $id, $mode) } else { - // Delete post in queue notification $phpbb_notifications->delete_notifications(array('post_in_queue'), $post_id); - // Topic Notifications $phpbb_notifications->add_notifications(array('quote', 'bookmark', 'post'), $post_data); - // Notify poster? if ($notify_poster) { $phpbb_notifications->add_notifications('approve_post', $post_data); @@ -859,7 +851,6 @@ function disapprove_post($post_id_list, $id, $mode) } } - // Handle notifications (topic/post in queue) foreach ($post_info as $post_id => $post_data) { if ($post_id == $post_data['topic_first_post_id'] && $post_id == $post_data['topic_last_post_id']) @@ -912,7 +903,6 @@ function disapprove_post($post_id_list, $id, $mode) if ($post_id == $post_data['topic_first_post_id'] && $post_id == $post_data['topic_last_post_id']) { - // Notify poster? if ($notify_poster) { $phpbb_notifications->add_notifications('disapprove_topic', $post_data); @@ -920,7 +910,6 @@ function disapprove_post($post_id_list, $id, $mode) } else { - // Notify poster? if ($notify_poster) { $phpbb_notifications->add_notifications('disapprove_post', $post_data); -- cgit v1.2.1 From 94d682f77431add84867bb0b196ad0719b293606 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sat, 20 Oct 2012 20:54:18 -0500 Subject: [ticket/11103] Use the full class name as the item_type/method This is going to require you recreate the db tables. PHPBB3-11103 --- phpBB/includes/mcp/mcp_queue.php | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'phpBB/includes/mcp/mcp_queue.php') diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 72f1c00c72..f13ce914bf 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -86,7 +86,7 @@ class mcp_queue { $post_id = (int) $topic_info[$topic_id]['topic_first_post_id']; - $phpbb_notifications->mark_notifications_read('topic_in_queue', $topic_id, $user->data['user_id']); + $phpbb_notifications->mark_notifications_read('phpbb_notification_type_topic_in_queue', $topic_id, $user->data['user_id']); } else { @@ -94,7 +94,7 @@ class mcp_queue } } - $phpbb_notifications->mark_notifications_read('post_in_queue', $post_id, $user->data['user_id']); + $phpbb_notifications->mark_notifications_read('phpbb_notification_type_post_in_queue', $post_id, $user->data['user_id']); $post_info = get_post_data(array($post_id), 'm_approve', true); @@ -610,24 +610,28 @@ function approve_post($post_id_list, $id, $mode) { if ($post_id == $post_data['topic_first_post_id'] && $post_id == $post_data['topic_last_post_id']) { - $phpbb_notifications->delete_notifications(array('topic_in_queue'), $post_data['topic_id']); + $phpbb_notifications->delete_notifications('phpbb_notification_type_topic_in_queue', $post_data['topic_id']); - $phpbb_notifications->add_notifications('topic', $post_data); + $phpbb_notifications->add_notifications('phpbb_notification_type_topic', $post_data); if ($notify_poster) { - $phpbb_notifications->add_notifications('approve_topic', $post_data); + $phpbb_notifications->add_notifications('phpbb_notification_type_approve_topic', $post_data); } } else { - $phpbb_notifications->delete_notifications(array('post_in_queue'), $post_id); + $phpbb_notifications->delete_notifications('phpbb_notification_type_post_in_queue', $post_id); - $phpbb_notifications->add_notifications(array('quote', 'bookmark', 'post'), $post_data); + $phpbb_notifications->add_notifications(array( + 'phpbb_notification_type_quote', + 'phpbb_notification_type_bookmark', + 'phpbb_notification_type_post', + ), $post_data); if ($notify_poster) { - $phpbb_notifications->add_notifications('approve_post', $post_data); + $phpbb_notifications->add_notifications('phpbb_notification_type_approve_post', $post_data); } } } @@ -855,11 +859,11 @@ function disapprove_post($post_id_list, $id, $mode) { if ($post_id == $post_data['topic_first_post_id'] && $post_id == $post_data['topic_last_post_id']) { - $phpbb_notifications->delete_notifications(array('topic_in_queue'), $post_data['topic_id']); + $phpbb_notifications->delete_notifications('phpbb_notification_type_topic_in_queue', $post_data['topic_id']); } else { - $phpbb_notifications->delete_notifications(array('post_in_queue'), $post_id); + $phpbb_notifications->delete_notifications('phpbb_notification_type_post_in_queue', $post_id); } } @@ -905,14 +909,14 @@ function disapprove_post($post_id_list, $id, $mode) { if ($notify_poster) { - $phpbb_notifications->add_notifications('disapprove_topic', $post_data); + $phpbb_notifications->add_notifications('phpbb_notification_type_disapprove_topic', $post_data); } } else { if ($notify_poster) { - $phpbb_notifications->add_notifications('disapprove_post', $post_data); + $phpbb_notifications->add_notifications('phpbb_notification_type_disapprove_post', $post_data); } } } -- cgit v1.2.1 From 2afb8b9df873c3f9572a32ab7a62ea8ba8d8a45b Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Tue, 20 Nov 2012 18:14:48 -0600 Subject: [ticket/11103] Create user loader class, update for DIC Create a very basic user loader class to handle querying/storing user data in a centralized location. Use DIC collection service for notification types/methods. Cleanup unused dependencies. Fix some other issues. PHPBB3-11103 --- phpBB/includes/mcp/mcp_queue.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'phpBB/includes/mcp/mcp_queue.php') diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index f13ce914bf..4a3d443006 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -86,7 +86,7 @@ class mcp_queue { $post_id = (int) $topic_info[$topic_id]['topic_first_post_id']; - $phpbb_notifications->mark_notifications_read('phpbb_notification_type_topic_in_queue', $topic_id, $user->data['user_id']); + $phpbb_notifications->mark_notifications_read('topic_in_queue', $topic_id, $user->data['user_id']); } else { @@ -94,7 +94,7 @@ class mcp_queue } } - $phpbb_notifications->mark_notifications_read('phpbb_notification_type_post_in_queue', $post_id, $user->data['user_id']); + $phpbb_notifications->mark_notifications_read('post_in_queue', $post_id, $user->data['user_id']); $post_info = get_post_data(array($post_id), 'm_approve', true); @@ -610,28 +610,28 @@ function approve_post($post_id_list, $id, $mode) { if ($post_id == $post_data['topic_first_post_id'] && $post_id == $post_data['topic_last_post_id']) { - $phpbb_notifications->delete_notifications('phpbb_notification_type_topic_in_queue', $post_data['topic_id']); + $phpbb_notifications->delete_notifications('topic_in_queue', $post_data['topic_id']); - $phpbb_notifications->add_notifications('phpbb_notification_type_topic', $post_data); + $phpbb_notifications->add_notifications('topic', $post_data); if ($notify_poster) { - $phpbb_notifications->add_notifications('phpbb_notification_type_approve_topic', $post_data); + $phpbb_notifications->add_notifications('approve_topic', $post_data); } } else { - $phpbb_notifications->delete_notifications('phpbb_notification_type_post_in_queue', $post_id); + $phpbb_notifications->delete_notifications('post_in_queue', $post_id); $phpbb_notifications->add_notifications(array( - 'phpbb_notification_type_quote', - 'phpbb_notification_type_bookmark', - 'phpbb_notification_type_post', + 'quote', + 'bookmark', + 'post', ), $post_data); if ($notify_poster) { - $phpbb_notifications->add_notifications('phpbb_notification_type_approve_post', $post_data); + $phpbb_notifications->add_notifications('approve_post', $post_data); } } } @@ -859,11 +859,11 @@ function disapprove_post($post_id_list, $id, $mode) { if ($post_id == $post_data['topic_first_post_id'] && $post_id == $post_data['topic_last_post_id']) { - $phpbb_notifications->delete_notifications('phpbb_notification_type_topic_in_queue', $post_data['topic_id']); + $phpbb_notifications->delete_notifications('topic_in_queue', $post_data['topic_id']); } else { - $phpbb_notifications->delete_notifications('phpbb_notification_type_post_in_queue', $post_id); + $phpbb_notifications->delete_notifications('post_in_queue', $post_id); } } @@ -909,14 +909,14 @@ function disapprove_post($post_id_list, $id, $mode) { if ($notify_poster) { - $phpbb_notifications->add_notifications('phpbb_notification_type_disapprove_topic', $post_data); + $phpbb_notifications->add_notifications('disapprove_topic', $post_data); } } else { if ($notify_poster) { - $phpbb_notifications->add_notifications('phpbb_notification_type_disapprove_post', $post_data); + $phpbb_notifications->add_notifications('disapprove_post', $post_data); } } } -- cgit v1.2.1 From 249f3c8885d461ae3981dfd7b62093c2175175e3 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 13 Dec 2012 19:19:40 -0600 Subject: [ticket/11103] Instantiate $phpbb_notifications as needed https://github.com/phpbb/phpbb3/pull/992#discussion_r2413976 PHPBB3-11103 --- phpBB/includes/mcp/mcp_queue.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'phpBB/includes/mcp/mcp_queue.php') diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 4a3d443006..2a2146db71 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -33,8 +33,7 @@ class mcp_queue function main($id, $mode) { global $auth, $db, $user, $template, $cache; - global $config, $phpbb_root_path, $phpEx, $action; - global $phpbb_notifications; + global $config, $phpbb_root_path, $phpEx, $action, $phpbb_container; include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); @@ -79,6 +78,8 @@ class mcp_queue $post_id = request_var('p', 0); $topic_id = request_var('t', 0); + $phpbb_notifications = $phpbb_container->get('notification_manager'); + if ($topic_id) { $topic_info = get_topic_data(array($topic_id), 'm_approve'); @@ -456,7 +457,7 @@ function approve_post($post_id_list, $id, $mode) { global $db, $template, $user, $config; global $phpEx, $phpbb_root_path; - global $request, $phpbb_notifications; + global $request, $phpbb_container; if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve'))) { @@ -605,6 +606,8 @@ function approve_post($post_id_list, $id, $mode) // Send out normal user notifications $email_sig = str_replace('
', "\n", "-- \n" . $config['board_email_sig']); + $phpbb_notifications = $phpbb_container->get('notification_manager'); + // Handle notifications foreach ($post_info as $post_id => $post_data) { @@ -722,7 +725,7 @@ function disapprove_post($post_id_list, $id, $mode) { global $db, $template, $user, $config; global $phpEx, $phpbb_root_path; - global $request, $phpbb_notifications; + global $request, $phpbb_container; if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve'))) { @@ -855,6 +858,8 @@ function disapprove_post($post_id_list, $id, $mode) } } + $phpbb_notifications = $phpbb_container->get('notification_manager'); + foreach ($post_info as $post_id => $post_data) { if ($post_id == $post_data['topic_first_post_id'] && $post_id == $post_data['topic_last_post_id']) -- cgit v1.2.1 From 95bd4d73eb41d677470b0bf77c521ae2a9bb731e Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sat, 15 Dec 2012 10:33:03 -0600 Subject: [ticket/11103] Mark topic/post subscription notification read when approved PHPBB3-11103 --- phpBB/includes/mcp/mcp_queue.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/mcp/mcp_queue.php') diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 2a2146db71..24afa1f210 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -615,7 +615,13 @@ function approve_post($post_id_list, $id, $mode) { $phpbb_notifications->delete_notifications('topic_in_queue', $post_data['topic_id']); - $phpbb_notifications->add_notifications('topic', $post_data); + $phpbb_notifications->add_notifications(array( + 'quote', + 'topic', + ), $post_data); + + $phpbb_notifications->mark_notifications_read('quote', $post_data['post_id'], $user->data['user_id']); + $phpbb_notifications->mark_notifications_read('topic', $post_data['topic_id'], $user->data['user_id']); if ($notify_poster) { @@ -631,6 +637,12 @@ function approve_post($post_id_list, $id, $mode) 'bookmark', 'post', ), $post_data); + + $phpbb_notifications->mark_notifications_read(array( + 'quote', + 'bookmark', + 'post', + ),$post_data['post_id'], $user->data['user_id']); if ($notify_poster) { -- cgit v1.2.1