Merge pull request #52700 from nextcloud/backport/52699/stable30

[stable30] fix(webhooks_listener): correctly set userId from event
This commit is contained in:
Andy Scherzinger 2025-05-29 15:35:19 +02:00 committed by GitHub
commit cf335639d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View file

@ -72,7 +72,8 @@ class WebhookCall extends QueuedJob {
} elseif (!$exApp['enabled']) {
throw new RuntimeException('ExApp ' . $exAppId . ' is disabled.');
}
$response = $appApiFunctions->exAppRequest($exAppId, $webhookUri, $webhookListener->getUserId(), $webhookListener->getHttpMethod(), [], $options);
$userId = ($data['user'] ?? [])['uid'] ?? null;
$response = $appApiFunctions->exAppRequest($exAppId, $webhookUri, $userId, $webhookListener->getHttpMethod(), [], $options);
if (is_array($response) && isset($response['error'])) {
throw new RuntimeException(sprintf('Error during request to ExApp(%s): %s', $exAppId, $response['error']));
}

View file

@ -41,6 +41,7 @@ class WebhooksEventListener implements IEventListener {
// TODO add group membership to be able to filter on it
$data = [
'event' => $this->serializeEvent($event),
/* Do not remove 'user' from here, see BackgroundJobs/WebhookCall.php */
'user' => (is_null($user) ? null : JsonSerializer::serializeUser($user)),
'time' => time(),
];