1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 14:00:31 +02:00

[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
This commit is contained in:
Nathan Guse
2012-10-12 16:54:42 -05:00
parent 8b2f1127e4
commit 3d79ce2803
17 changed files with 169 additions and 36 deletions

View File

@@ -324,8 +324,6 @@ class phpbb_notification_manager
// Make sure not to send new notifications to users who've already been notified about this item
// This may happen when an item was added, but now new users are able to see the item
// todo Users should not receive notifications from multiple events from the same item (ex: for a topic reply with a quote including your username)
// Probably should be handled within each type?
$sql = 'SELECT user_id
FROM ' . NOTIFICATIONS_TABLE . "
WHERE item_type = '" . $this->db->sql_escape($item_type) . "'
@@ -342,6 +340,11 @@ class phpbb_notification_manager
return;
}
// Allow notifications to perform actions before creating the insert array (such as run a query to cache some data needed for all notifications)
$notification = $this->get_item_type_class($item_type_class_name);
$pre_create_data = $notification->pre_create_insert_array($data, $notify_users);
unset($notification);
// Go through each user so we can insert a row in the DB and then notify them by their desired means
foreach ($notify_users as $user => $methods)
{
@@ -350,7 +353,7 @@ class phpbb_notification_manager
$notification->user_id = (int) $user;
// Store the creation array in our new rows that will be inserted later
$new_rows[] = $notification->create_insert_array($data);
$new_rows[] = $notification->create_insert_array($data, $pre_create_data);
// Users are needed to send notifications
$user_ids = array_merge($user_ids, $notification->users_to_query());