Skip to content

Commit 59bd2ae

Browse files
committed
fixup! fix(federation): remove background jobs when removing trusted servers
1 parent c372d71 commit 59bd2ae

3 files changed

Lines changed: 12 additions & 8 deletions

File tree

apps/federation/lib/Listener/TrustedServerRemovedListener.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ public function handle(Event $event): void {
2828
return;
2929
}
3030

31+
if ($event->getUrl() === null) {
32+
return; // safe guard
33+
}
34+
3135
$this->removeJobsByUrl(RequestSharedSecret::class, $event->getUrl());
3236
$this->removeJobsByUrl(GetSharedSecret::class, $event->getUrl());
3337
}

apps/federation/lib/TrustedServers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function addSharedSecret(string $url, string $sharedSecret): void {
8888
public function removeServer(int $id): void {
8989
$server = $this->dbHandler->getServerById($id);
9090
$this->dbHandler->removeServer($id);
91-
$this->dispatcher->dispatchTyped(new TrustedServerRemovedEvent($server['url'], $server['url_hash']));
91+
$this->dispatcher->dispatchTyped(new TrustedServerRemovedEvent($server['url_hash'], $server['url']));
9292

9393
}
9494

lib/public/Federation/Events/TrustedServerRemovedEvent.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,23 @@ class TrustedServerRemovedEvent extends Event {
2020
* @since 32.0.0 Added $url argument
2121
*/
2222
public function __construct(
23-
private readonly string $url,
2423
private readonly string $urlHash,
24+
private readonly ?string $url = null,
2525
) {
2626
parent::__construct();
2727
}
2828

2929
/**
30-
* @since 32.0.0
30+
* @since 25.0.0
3131
*/
32-
public function getUrl(): string {
33-
return $this->url;
32+
public function getUrlHash(): string {
33+
return $this->urlHash;
3434
}
3535

3636
/**
37-
* @since 25.0.0
37+
* @since 32.0.0
3838
*/
39-
public function getUrlHash(): string {
40-
return $this->urlHash;
39+
public function getUrl(): ?string {
40+
return $this->url;
4141
}
4242
}

0 commit comments

Comments
 (0)