aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/includes/notification/type/bookmark.php21
-rw-r--r--phpBB/includes/notification/type/quote.php21
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;
}