mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
(fix): defer event copy in UserEvents to fire-time for correct user context
The UserEvents hook copied event state at resource-resolution time (before the init hook set the user), causing webhooks to receive null user IDs. Now stores the source queueForEvents as a reference and copies at fire-time when the user Document has been populated. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
48a01919bc
commit
f66150aa8b
@@ -672,10 +672,11 @@ Http::setResource('dbForProject', function (Group $pools, Database $dbForPlatfor
|
||||
->addHook(new UserEvents(
|
||||
$project,
|
||||
$response,
|
||||
$queueForEventsClone->from($queueForEvents),
|
||||
$queueForFunctions->from($queueForEvents),
|
||||
$queueForWebhooks->from($queueForEvents),
|
||||
$queueForRealtime->from($queueForEvents),
|
||||
$queueForEvents,
|
||||
$queueForEventsClone,
|
||||
$queueForFunctions,
|
||||
$queueForWebhooks,
|
||||
$queueForRealtime,
|
||||
))
|
||||
->addHook(new FunctionCache($project, $database))
|
||||
->addHook(new Permissions());
|
||||
|
||||
@@ -21,6 +21,7 @@ class UserEvents implements Lifecycle
|
||||
public function __construct(
|
||||
private Document $project,
|
||||
private Response $response,
|
||||
private Event $source,
|
||||
private Event $events,
|
||||
private Func $functions,
|
||||
private Webhook $webhooks,
|
||||
@@ -39,6 +40,7 @@ class UserEvents implements Lifecycle
|
||||
}
|
||||
|
||||
$this->events
|
||||
->from($this->source)
|
||||
->setProject($this->project)
|
||||
->setEvent('users.[userId].create')
|
||||
->setParam('userId', $data->getId())
|
||||
|
||||
Reference in New Issue
Block a user