1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-06-04 21:44:57 +02:00

[ticket/12032] Do not inherit read status in certain notifications.

PHPBB3-12032
This commit is contained in:
Cesar G 2014-01-16 17:27:30 -08:00
parent 670a9a1aea
commit 4bb05c74e5
8 changed files with 60 additions and 4 deletions

View File

@ -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)
*

View File

@ -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)
*

View File

@ -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)
*

View File

@ -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)
*

View File

@ -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;
}

View File

@ -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)
*

View File

@ -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;

View File

@ -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;
}