1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-10-05 20:21:53 +02:00

Merge pull request #6844 from iMattPro/ticket/17451

[ticket/17451] Web push service worker shouldn't update user activity
This commit is contained in:
Marc Alexander
2025-09-16 19:47:44 +02:00
committed by GitHub

View File

@@ -1715,7 +1715,7 @@ class session
{
global $db;
if (isset($this->data['session_time'], $this->data['user_id']))
if (isset($this->data['session_time'], $this->data['user_id']) && !$this->is_push_notification_request())
{
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_lastvisit = ' . (int) $this->data['session_time'] . ',
@@ -1734,7 +1734,7 @@ class session
{
global $db;
if (isset($this->time_now, $this->data['user_id']))
if (isset($this->time_now, $this->data['user_id']) && !$this->is_push_notification_request())
{
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_last_active = ' . $this->time_now . '
@@ -1742,4 +1742,16 @@ class session
$db->sql_query($sql);
}
}
/**
* Determine if the request is an Ajax request from the web push service worker
*
* @return bool True if the request is an Ajax request and the page URL contains '/push/notification', otherwise false
*/
protected function is_push_notification_request(): bool
{
global $request;
return $request->is_ajax() && str_contains($this->page['page'], '/push/notification');
}
}