mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/11103] unread -> notification_read
PHPBB3-11103
This commit is contained in:
@@ -128,8 +128,13 @@ class phpbb_notification_manager
|
||||
$sql = 'SELECT COUNT(n.notification_id) AS unread_count
|
||||
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt
|
||||
WHERE n.user_id = ' . (int) $options['user_id'] . '
|
||||
<<<<<<< HEAD
|
||||
AND n.unread = 1
|
||||
AND nt.notification_type = n.item_type
|
||||
=======
|
||||
AND n.notification_read = 0
|
||||
AND nt.notification_type = n.notification_type
|
||||
>>>>>>> 5cedca0... [ticket/11103] unread -> notification_read
|
||||
AND nt.notification_type_enabled = 1';
|
||||
$result = $this->db->sql_query($sql);
|
||||
$unread_count = (int) $this->db->sql_fetchfield('unread_count', $result);
|
||||
@@ -175,7 +180,7 @@ class phpbb_notification_manager
|
||||
$sql = 'SELECT n.*
|
||||
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt
|
||||
WHERE n.user_id = ' . (int) $options['user_id'] . '
|
||||
AND n.unread = 1
|
||||
AND n.notification_read = 0
|
||||
AND ' . $this->db->sql_in_set('n.notification_id', array_keys($rowset), true) . '
|
||||
AND nt.notification_type = n.item_type
|
||||
AND nt.notification_type_enabled = 1
|
||||
@@ -237,7 +242,7 @@ class phpbb_notification_manager
|
||||
$time = ($time !== false) ? $time : time();
|
||||
|
||||
$sql = 'UPDATE ' . $this->notifications_table . "
|
||||
SET unread = 0
|
||||
SET notification_read = 1
|
||||
WHERE notification_time <= " . $time .
|
||||
(($item_type !== false) ? ' AND ' . (is_array($item_type) ? $this->db->sql_in_set('item_type', $item_type) : " item_type = '" . $this->db->sql_escape($item_type) . "'") : '') .
|
||||
(($item_id !== false) ? ' AND ' . (is_array($item_id) ? $this->db->sql_in_set('item_id', $item_id) : 'item_id = ' . (int) $item_id) : '') .
|
||||
@@ -267,8 +272,10 @@ class phpbb_notification_manager
|
||||
$time = ($time !== false) ? $time : time();
|
||||
|
||||
$sql = 'UPDATE ' . $this->notifications_table . "
|
||||
SET unread = 0
|
||||
SET notification_read = 1
|
||||
WHERE item_type = '" . $this->db->sql_escape($item_type) . "'
|
||||
SET notification_read = 1
|
||||
WHERE notification_type = '" . $this->db->sql_escape($notification_type) . "'
|
||||
AND notification_time <= " . $time .
|
||||
(($item_parent_id !== false) ? ' AND ' . (is_array($item_parent_id) ? $this->db->sql_in_set('item_parent_id', $item_parent_id) : 'item_parent_id = ' . (int) $item_parent_id) : '') .
|
||||
(($user_id !== false) ? ' AND ' . (is_array($user_id) ? $this->db->sql_in_set('user_id', $user_id) : 'user_id = ' . (int) $user_id) : '');
|
||||
@@ -286,7 +293,7 @@ class phpbb_notification_manager
|
||||
$time = ($time !== false) ? $time : time();
|
||||
|
||||
$sql = 'UPDATE ' . $this->notifications_table . "
|
||||
SET unread = 0
|
||||
SET notification_read = 1
|
||||
WHERE notification_time <= " . $time . '
|
||||
AND ' . ((is_array($notification_id)) ? $this->db->sql_in_set('notification_id', $notification_id) : 'notification_id = ' . (int) $notification_id);
|
||||
$this->db->sql_query($sql);
|
||||
|
@@ -168,8 +168,8 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
|
||||
'item_type' => $this->get_type(),
|
||||
'item_parent_id' => static::get_item_parent_id($type_data),
|
||||
|
||||
'notification_time' => time(),
|
||||
'unread' => true,
|
||||
'notification_time' => time(),
|
||||
'notification_read' => false,
|
||||
|
||||
'data' => array(),
|
||||
), $this->data);
|
||||
@@ -197,7 +197,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
|
||||
unset(
|
||||
$data['notification_time'], // Also unsetting time, since it always tries to change the time to current (if you actually need to change the time, over-ride this function)
|
||||
$data['notification_id'],
|
||||
$data['unread'],
|
||||
$data['notification_read'],
|
||||
$data['user_id']
|
||||
);
|
||||
|
||||
@@ -252,9 +252,9 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
|
||||
'URL' => $this->get_url(),
|
||||
'TIME' => $this->user->format_date($this->notification_time),
|
||||
|
||||
'UNREAD' => $this->unread,
|
||||
'UNREAD' => !$this->notification_read,
|
||||
|
||||
'U_MARK_READ' => ($this->unread) ? $u_mark_read : '',
|
||||
'U_MARK_READ' => (!$this->notification_read) ? $u_mark_read : '',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
|
||||
*/
|
||||
protected function mark($unread = true, $return = false)
|
||||
{
|
||||
$this->unread = (bool) $unread;
|
||||
$this->notification_read = (bool) !$unread;
|
||||
|
||||
$where = array(
|
||||
"item_type = '" . $this->db->sql_escape($this->item_type) . "'",
|
||||
@@ -417,7 +417,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
|
||||
}
|
||||
|
||||
$sql = 'UPDATE ' . $this->notifications_table . '
|
||||
SET unread = ' . (int) $this->unread . '
|
||||
SET notification_read = ' . (int) $this->notification_read . '
|
||||
WHERE ' . $where;
|
||||
$this->db->sql_query($sql);
|
||||
}
|
||||
|
@@ -105,7 +105,7 @@ class phpbb_notification_type_bookmark extends phpbb_notification_type_post
|
||||
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . " nt
|
||||
WHERE n.item_type = '" . $this->get_type() . "'
|
||||
AND n.item_parent_id = " . (int) self::get_item_parent_id($post) . '
|
||||
AND n.unread = 1
|
||||
AND n.notification_read = 0
|
||||
AND nt.notification_type = n.item_type
|
||||
AND nt.notification_type_enabled = 1';
|
||||
$result = $this->db->sql_query($sql);
|
||||
|
@@ -126,7 +126,7 @@ class phpbb_notification_type_post extends phpbb_notification_type_base
|
||||
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . " nt
|
||||
WHERE n.item_type = '" . $this->get_type() . "'
|
||||
AND n.item_parent_id = " . (int) self::get_item_parent_id($post) . '
|
||||
AND n.unread = 1
|
||||
AND n.notification_read = 0
|
||||
AND nt.notification_type = n.item_type
|
||||
AND nt.notification_type_enabled = 1';
|
||||
$result = $this->db->sql_query($sql);
|
||||
@@ -326,7 +326,7 @@ class phpbb_notification_type_post extends phpbb_notification_type_base
|
||||
// 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)
|
||||
{
|
||||
$this->unread = false;
|
||||
$this->notification_read = true;
|
||||
}
|
||||
|
||||
return parent::create_insert_array($post, $pre_create_data);
|
||||
|
@@ -124,7 +124,7 @@ class phpbb_notification_type_quote extends phpbb_notification_type_post
|
||||
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . " nt
|
||||
WHERE n.item_type = '" . $this->get_type() . "'
|
||||
AND n.item_parent_id = " . (int) self::get_item_parent_id($post) . '
|
||||
AND n.unread = 1
|
||||
AND n.notification_read = 0
|
||||
AND nt.notification_type = n.item_type
|
||||
AND nt.notification_type_enabled = 1';
|
||||
$result = $this->db->sql_query($sql);
|
||||
|
@@ -267,7 +267,7 @@ class phpbb_notification_type_topic extends phpbb_notification_type_base
|
||||
// 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)
|
||||
{
|
||||
$this->unread = false;
|
||||
$this->notification_read = true;
|
||||
}
|
||||
|
||||
return parent::create_insert_array($post, $pre_create_data);
|
||||
|
Reference in New Issue
Block a user