Skip to content

Commit

Permalink
fix: app disable listener now deletes sources for all users
Browse files Browse the repository at this point in the history
- introduce a call to /deleteSourcesByProviderForAllUsers

Signed-off-by: Anupam Kumar <[email protected]>
  • Loading branch information
kyteinsky committed Mar 1, 2024
1 parent a9b4e3b commit 661ff4e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
8 changes: 1 addition & 7 deletions lib/Listener/AppDisableListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public function __construct(
private ProviderConfigService $configService,
private LangRopeService $service,
private LoggerInterface $logger,
private ?string $userId,
) {
}

Expand All @@ -37,11 +36,6 @@ public function handle(Event $event): void {
return;
}

if ($this->userId === null) {
$this->logger->warning('No user id provided for app disable');
return;
}

foreach ($this->configService->getProviders() as $key => $values) {
/** @var string[] */
$identifierValues = explode('__', $key, 2);
Expand All @@ -58,7 +52,7 @@ public function handle(Event $event): void {
}

$this->configService->removeProvider($appId, $providerId);
$this->service->deleteSourcesByProvider($this->userId, $key);
$this->service->deleteSourcesByProviderForAllUsers($providerId);
}
}
}
12 changes: 12 additions & 0 deletions lib/Service/LangRopeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,18 @@ public function deleteSourcesByProvider(string $userId, string $providerKey): vo
$this->requestToExApp('/deleteSourcesByProvider', 'POST', $params);
}

/**
* @param string $providerKey
* @return void
*/
public function deleteSourcesByProviderForAllUsers(string $providerKey): void {
$params = [
'providerKey' => $providerKey,
];

$this->requestToExApp('/deleteSourcesByProviderForAllUsers', 'POST', $params);
}

/**
* @param string $userId
* @param string[] $sourceNames
Expand Down

0 comments on commit 661ff4e

Please sign in to comment.