Skip to content

Commit 33585c0

Browse files
janepiejulien-nc
andauthored
Apply suggestions from code review
Co-authored-by: Julien Veyssier <[email protected]> Signed-off-by: janepie <[email protected]>
1 parent 24c3347 commit 33585c0

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

apps/webhook_listeners/lib/BackgroundJobs/WebhookCall.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ protected function run($argument): void {
9797
}
9898

9999
private function getTokens($webhookListener, $triggerUserId): array {
100-
$tokens = [];
100+
$tokens = [
101+
'users' => [],
102+
'functions' => [],
103+
];
101104
$tokenNeeded = $webhookListener->getTokenNeeded();
102105
if (isset($tokenNeeded['users'])) {
103106
foreach ($tokenNeeded['users'] as $userId) {

apps/webhook_listeners/lib/Db/WebhookListener.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,15 @@ public function getAppId(): ?string {
169169
}
170170

171171

172-
public function createTemporaryToken($userId) {
172+
public function createTemporaryToken(string $userId): IToken {
173173
$token = $this->generateRandomDeviceToken();
174-
$name = 'Authentication for Webhook';
174+
$name = 'Ephemeral webhook authentication';
175175
$password = null;
176176
$deviceToken = $this->tokenProvider->generateToken($token, $userId, $userId, $password, $name, IToken::PERMANENT_TOKEN);
177177
return $token;
178178
}
179179

180-
private function generateRandomDeviceToken() {
180+
private function generateRandomDeviceToken(): string {
181181
$groups = [];
182182
for ($i = 0; $i < 5; $i++) {
183183
$groups[] = $this->random->generate(5, ISecureRandom::CHAR_HUMAN_READABLE);

0 commit comments

Comments
 (0)