diff options
| author | Nathan Guse <nathaniel.guse@gmail.com> | 2012-10-12 11:40:13 -0500 |
|---|---|---|
| committer | Nathan Guse <nathaniel.guse@gmail.com> | 2012-10-12 11:40:13 -0500 |
| commit | 8b2f1127e4167e241c41f8709964c203e401de94 (patch) | |
| tree | 23edb4a8d1edbb514b96a41fd0a764f012647479 /phpBB/includes | |
| parent | 43e3af4b46bdfe0935c766489a66c5c0f8786e3f (diff) | |
| download | forums-8b2f1127e4167e241c41f8709964c203e401de94.tar forums-8b2f1127e4167e241c41f8709964c203e401de94.tar.gz forums-8b2f1127e4167e241c41f8709964c203e401de94.tar.bz2 forums-8b2f1127e4167e241c41f8709964c203e401de94.tar.xz forums-8b2f1127e4167e241c41f8709964c203e401de94.zip | |
[ticket/11103] Notification grouping output for bookmark/quote
PHPBB3-11103
Diffstat (limited to 'phpBB/includes')
| -rw-r--r-- | phpBB/includes/notification/type/bookmark.php | 21 | ||||
| -rw-r--r-- | phpBB/includes/notification/type/quote.php | 21 |
2 files changed, 42 insertions, 0 deletions
diff --git a/phpBB/includes/notification/type/bookmark.php b/phpBB/includes/notification/type/bookmark.php index 6c42f1d860..8a23859d05 100644 --- a/phpBB/includes/notification/type/bookmark.php +++ b/phpBB/includes/notification/type/bookmark.php @@ -107,6 +107,27 @@ class phpbb_notification_type_bookmark extends phpbb_notification_type_post } $this->db->sql_freeresult($result); + // Try to find the users who already have been notified about replies and have not read the topic since and just update their notifications + $update_notifications = array(); + $sql = 'SELECT * + FROM ' . NOTIFICATIONS_TABLE . " + WHERE item_type = '" . self::get_item_type() . "' + AND item_parent_id = " . (int) self::get_item_parent_id($post) . ' + AND unread = 1'; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + // Do not create a new notification + unset($notify_users[$row['user_id']]); + + $notification = $this->notification_manager->get_item_type_class(self::get_item_type(), $row); + $sql = 'UPDATE ' . NOTIFICATIONS_TABLE . ' + SET ' . $this->db->sql_build_array('UPDATE', $notification->add_responders($post)) . ' + WHERE notification_id = ' . $row['notification_id']; + $this->db->sql_query($sql); + } + $this->db->sql_freeresult($result); + return $notify_users; } } diff --git a/phpBB/includes/notification/type/quote.php b/phpBB/includes/notification/type/quote.php index 1eea8f1066..34907ef8d6 100644 --- a/phpBB/includes/notification/type/quote.php +++ b/phpBB/includes/notification/type/quote.php @@ -126,6 +126,27 @@ class phpbb_notification_type_quote extends phpbb_notification_type_post } $this->db->sql_freeresult($result); + // Try to find the users who already have been notified about replies and have not read the topic since and just update their notifications + $update_notifications = array(); + $sql = 'SELECT * + FROM ' . NOTIFICATIONS_TABLE . " + WHERE item_type = '" . self::get_item_type() . "' + AND item_parent_id = " . (int) self::get_item_parent_id($post) . ' + AND unread = 1'; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + // Do not create a new notification + unset($notify_users[$row['user_id']]); + + $notification = $this->notification_manager->get_item_type_class(self::get_item_type(), $row); + $sql = 'UPDATE ' . NOTIFICATIONS_TABLE . ' + SET ' . $this->db->sql_build_array('UPDATE', $notification->add_responders($post)) . ' + WHERE notification_id = ' . $row['notification_id']; + $this->db->sql_query($sql); + } + $this->db->sql_freeresult($result); + return $notify_users; } |
