diff --git a/phpBB/phpbb/notification/type/approve_post.php b/phpBB/phpbb/notification/type/approve_post.php index 51a9a704b0..e51ff12b3e 100644 --- a/phpBB/phpbb/notification/type/approve_post.php +++ b/phpBB/phpbb/notification/type/approve_post.php @@ -34,6 +34,13 @@ class approve_post extends \phpbb\notification\type\post */ protected $language_key = 'NOTIFICATION_POST_APPROVED'; + /** + * Inherit notification read status from post. + * + * @var bool + */ + protected $inherit_read_status = false; + /** * Notification option data (for outputting to the user) * diff --git a/phpBB/phpbb/notification/type/approve_topic.php b/phpBB/phpbb/notification/type/approve_topic.php index 6229800c68..11a240e03d 100644 --- a/phpBB/phpbb/notification/type/approve_topic.php +++ b/phpBB/phpbb/notification/type/approve_topic.php @@ -34,6 +34,13 @@ class approve_topic extends \phpbb\notification\type\topic */ protected $language_key = 'NOTIFICATION_TOPIC_APPROVED'; + /** + * Inherit notification read status from topic. + * + * @var bool + */ + protected $inherit_read_status = false; + /** * Notification option data (for outputting to the user) * diff --git a/phpBB/phpbb/notification/type/disapprove_post.php b/phpBB/phpbb/notification/type/disapprove_post.php index 411d4195c7..70de2a3e10 100644 --- a/phpBB/phpbb/notification/type/disapprove_post.php +++ b/phpBB/phpbb/notification/type/disapprove_post.php @@ -34,6 +34,13 @@ class disapprove_post extends \phpbb\notification\type\approve_post */ protected $language_key = 'NOTIFICATION_POST_DISAPPROVED'; + /** + * Inherit notification read status from post. + * + * @var bool + */ + protected $inherit_read_status = false; + /** * Notification option data (for outputting to the user) * diff --git a/phpBB/phpbb/notification/type/disapprove_topic.php b/phpBB/phpbb/notification/type/disapprove_topic.php index 19e9d468ce..d39201d928 100644 --- a/phpBB/phpbb/notification/type/disapprove_topic.php +++ b/phpBB/phpbb/notification/type/disapprove_topic.php @@ -34,6 +34,13 @@ class disapprove_topic extends \phpbb\notification\type\approve_topic */ protected $language_key = 'NOTIFICATION_TOPIC_DISAPPROVED'; + /** + * Inherit notification read status from topic. + * + * @var bool + */ + protected $inherit_read_status = false; + /** * Notification option data (for outputting to the user) * diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php index c2854c17af..bc42c4422b 100644 --- a/phpBB/phpbb/notification/type/post.php +++ b/phpBB/phpbb/notification/type/post.php @@ -34,6 +34,13 @@ class post extends \phpbb\notification\type\base */ protected $language_key = 'NOTIFICATION_POST'; + /** + * Inherit notification read status from post. + * + * @var bool + */ + protected $inherit_read_status = true; + /** * Notification option data (for outputting to the user) * @@ -315,7 +322,7 @@ class post extends \phpbb\notification\type\base */ public function pre_create_insert_array($post, $notify_users) { - if (!sizeof($notify_users)) + if (!sizeof($notify_users) || !$this->inherit_read_status) { return array(); } @@ -360,7 +367,7 @@ class post extends \phpbb\notification\type\base // Topics can be "read" before they are public (while awaiting approval). // Make sure that if the user has read the topic, it's marked as read in the notification - if (isset($pre_create_data[$this->user_id]) && $pre_create_data[$this->user_id] >= $this->notification_time) + if ($this->inherit_read_status && isset($pre_create_data[$this->user_id]) && $pre_create_data[$this->user_id] >= $this->notification_time) { $this->notification_read = true; } diff --git a/phpBB/phpbb/notification/type/report_post.php b/phpBB/phpbb/notification/type/report_post.php index 89b497efa6..9bf035b91e 100644 --- a/phpBB/phpbb/notification/type/report_post.php +++ b/phpBB/phpbb/notification/type/report_post.php @@ -34,6 +34,13 @@ class report_post extends \phpbb\notification\type\post_in_queue */ protected $language_key = 'NOTIFICATION_REPORT_POST'; + /** + * Inherit notification read status from post. + * + * @var bool + */ + protected $inherit_read_status = false; + /** * Permission to check for (in find_users_for_notification) * diff --git a/phpBB/phpbb/notification/type/report_post_closed.php b/phpBB/phpbb/notification/type/report_post_closed.php index 5874d48e31..fff45612b3 100644 --- a/phpBB/phpbb/notification/type/report_post_closed.php +++ b/phpBB/phpbb/notification/type/report_post_closed.php @@ -41,6 +41,13 @@ class report_post_closed extends \phpbb\notification\type\post */ protected $language_key = 'NOTIFICATION_REPORT_CLOSED'; + /** + * Inherit notification read status from post. + * + * @var bool + */ + protected $inherit_read_status = false; + public function is_available() { return false; diff --git a/phpBB/phpbb/notification/type/topic.php b/phpBB/phpbb/notification/type/topic.php index 6198881d8d..98f086a50b 100644 --- a/phpBB/phpbb/notification/type/topic.php +++ b/phpBB/phpbb/notification/type/topic.php @@ -34,6 +34,13 @@ class topic extends \phpbb\notification\type\base */ protected $language_key = 'NOTIFICATION_TOPIC'; + /** + * Inherit notification read status from topic. + * + * @var bool + */ + protected $inherit_read_status = true; + /** * Notification option data (for outputting to the user) * @@ -220,7 +227,7 @@ class topic extends \phpbb\notification\type\base */ public function pre_create_insert_array($post, $notify_users) { - if (!sizeof($notify_users)) + if (!sizeof($notify_users) || !$this->inherit_read_status) { return array(); } @@ -261,7 +268,7 @@ class topic extends \phpbb\notification\type\base // Topics can be "read" before they are public (while awaiting approval). // Make sure that if the user has read the topic, it's marked as read in the notification - if (isset($pre_create_data[$this->user_id]) && $pre_create_data[$this->user_id] >= $this->notification_time) + if ($this->inherit_read_status && isset($pre_create_data[$this->user_id]) && $pre_create_data[$this->user_id] >= $this->notification_time) { $this->notification_read = true; }