Skip to content

Commit e5a579a

Browse files
Merge pull request #52701 from nextcloud/backport/52699/stable31
[stable31] fix(webhooks_listener): correctly set userId from event
2 parents 6b4a6a0 + 9a8ecb1 commit e5a579a

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

apps/webhook_listeners/lib/BackgroundJobs/WebhookCall.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ protected function run($argument): void {
7474
} elseif (!$exApp['enabled']) {
7575
throw new RuntimeException('ExApp ' . $exAppId . ' is disabled.');
7676
}
77-
$response = $appApiFunctions->exAppRequest($exAppId, $webhookUri, $webhookListener->getUserId(), $webhookListener->getHttpMethod(), [], $options);
77+
$userId = ($data['user'] ?? [])['uid'] ?? null;
78+
$response = $appApiFunctions->exAppRequest($exAppId, $webhookUri, $userId, $webhookListener->getHttpMethod(), [], $options);
7879
if (is_array($response) && isset($response['error'])) {
7980
throw new RuntimeException(sprintf('Error during request to ExApp(%s): %s', $exAppId, $response['error']));
8081
}

apps/webhook_listeners/lib/Listener/WebhooksEventListener.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public function handle(Event $event): void {
4141
// TODO add group membership to be able to filter on it
4242
$data = [
4343
'event' => $this->serializeEvent($event),
44+
/* Do not remove 'user' from here, see BackgroundJobs/WebhookCall.php */
4445
'user' => (is_null($user) ? null : JsonSerializer::serializeUser($user)),
4546
'time' => time(),
4647
];

0 commit comments

Comments
 (0)