mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
fix: add expiration check for presence updates to prevent outdated entries
This commit is contained in:
@@ -13,6 +13,7 @@ use Appwrite\SDK\Response as SDKResponse;
|
||||
use Appwrite\Utopia\Database\Documents\User;
|
||||
use Appwrite\Utopia\Response;
|
||||
use Utopia\Database\Database;
|
||||
use Utopia\Database\DateTime;
|
||||
use Utopia\Database\Document;
|
||||
use Utopia\Database\Exception\Conflict as ConflictException;
|
||||
use Utopia\Database\Exception\Duplicate;
|
||||
@@ -138,6 +139,11 @@ class Update extends PlatformAction
|
||||
throw new Exception(Exception::PRESENCE_NOT_FOUND, params: [$presenceId]);
|
||||
}
|
||||
|
||||
$presenceExpiresAt = $presence->getAttribute('expiresAt');
|
||||
if (!empty($presenceExpiresAt) && DateTime::formatTz($presenceExpiresAt) < DateTime::formatTz(DateTime::now())) {
|
||||
throw new Exception(Exception::PRESENCE_NOT_FOUND, params: [$presenceId]);
|
||||
}
|
||||
|
||||
$updateData = [];
|
||||
|
||||
if ($userId !== null) {
|
||||
|
||||
Reference in New Issue
Block a user