Skip to content

Commit 6190536

Browse files
oleksandr-ncAndyScherzinger
authored andcommitted
fix(webhooks_listener): correctly set userId from event
Signed-off-by: Oleksander Piskun <oleksandr2088@icloud.com>
1 parent 1c2e472 commit 6190536

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
@@ -72,7 +72,8 @@ protected function run($argument): void {
7272
} elseif (!$exApp['enabled']) {
7373
throw new RuntimeException('ExApp ' . $exAppId . ' is disabled.');
7474
}
75-
$response = $appApiFunctions->exAppRequest($exAppId, $webhookUri, $webhookListener->getUserId(), $webhookListener->getHttpMethod(), [], $options);
75+
$userId = ($data['user'] ?? [])['uid'] ?? null;
76+
$response = $appApiFunctions->exAppRequest($exAppId, $webhookUri, $userId, $webhookListener->getHttpMethod(), [], $options);
7677
if (is_array($response) && isset($response['error'])) {
7778
throw new RuntimeException(sprintf('Error during request to ExApp(%s): %s', $exAppId, $response['error']));
7879
}

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)