diff options
Diffstat (limited to 'phpBB/phpbb/notification')
-rw-r--r-- | phpBB/phpbb/notification/type/approve_post.php | 7 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/approve_topic.php | 7 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/base.php | 6 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/disapprove_post.php | 7 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/disapprove_topic.php | 7 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/post.php | 11 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/report_pm_closed.php | 2 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/report_post.php | 7 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/report_post_closed.php | 7 | ||||
-rw-r--r-- | phpBB/phpbb/notification/type/topic.php | 11 |
10 files changed, 65 insertions, 7 deletions
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 @@ -35,6 +35,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) * * @var bool|array False if the service should use it's default data 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 @@ -35,6 +35,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) * * @var bool|array False if the service should use it's default data diff --git a/phpBB/phpbb/notification/type/base.php b/phpBB/phpbb/notification/type/base.php index 951585853f..10c876b286 100644 --- a/phpBB/phpbb/notification/type/base.php +++ b/phpBB/phpbb/notification/type/base.php @@ -282,15 +282,17 @@ abstract class base implements \phpbb\notification\type\type_interface */ public function prepare_for_display() { + $mark_hash = generate_link_hash('mark_notification_read'); + if ($this->get_url()) { - $u_mark_read = append_sid($this->phpbb_root_path . 'index.' . $this->php_ext, 'mark_notification=' . $this->notification_id); + $u_mark_read = append_sid($this->phpbb_root_path . 'index.' . $this->php_ext, 'mark_notification=' . $this->notification_id . '&hash=' . $mark_hash); } else { $redirect = (($this->user->page['page_dir']) ? $this->user->page['page_dir'] . '/' : '') . $this->user->page['page_name'] . (($this->user->page['query_string']) ? '?' . $this->user->page['query_string'] : ''); - $u_mark_read = append_sid($this->phpbb_root_path . 'index.' . $this->php_ext, 'mark_notification=' . $this->notification_id . '&redirect=' . urlencode($redirect)); + $u_mark_read = append_sid($this->phpbb_root_path . 'index.' . $this->php_ext, 'mark_notification=' . $this->notification_id . '&hash=' . $mark_hash . '&redirect=' . urlencode($redirect)); } return array( 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 @@ -35,6 +35,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) * * @var bool|array False if the service should use it's default data 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 @@ -35,6 +35,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) * * @var bool|array False if the service should use it's default data 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 @@ -35,6 +35,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) * * @var bool|array False if the service should use it's default data @@ -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_pm_closed.php b/phpBB/phpbb/notification/type/report_pm_closed.php index 9d2aac329e..56485f5d37 100644 --- a/phpBB/phpbb/notification/type/report_pm_closed.php +++ b/phpBB/phpbb/notification/type/report_pm_closed.php @@ -114,7 +114,7 @@ class report_pm_closed extends \phpbb\notification\type\pm */ public function get_avatar() { - return $this->get_user_avatar($this->get_data('closer_id')); + return $this->user_loader->get_avatar($this->get_data('closer_id')); } /** 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 @@ -35,6 +35,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) * * @var string Permission name 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 @@ -35,6 +35,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) * * @var bool|array False if the service should use it's default data @@ -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; } |