Skip to content

Commit 4582aa9

Browse files
committed
feat: delete outgoing activities for deleted relay
1 parent 6bddc7c commit 4582aa9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/pages/federation.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { exportJwk, generateCryptoKeyPair, isActor } from "@fedify/fedify";
22
import { Temporal } from "@js-temporal/polyfill";
33
import { count, eq, sql } from "drizzle-orm";
4+
import { interval, jsonb, pgTable, timestamp, uuid } from "drizzle-orm/pg-core";
45
import { Hono } from "hono";
56
import { HTTPException } from "hono/http-exception";
67
import { DashboardLayout } from "../components/DashboardLayout";
@@ -16,6 +17,7 @@ import { persistAccount } from "../federation/account";
1617
import { isPost, persistPost } from "../federation/post";
1718
import { loginRequired } from "../login";
1819
import { accountOwners, accounts, instances, relays } from "../schema";
20+
import type { Uuid } from "../uuid";
1921

2022
const data = new Hono();
2123

@@ -410,6 +412,11 @@ data.post("/relay/:followRequestId/delete", async (c) => {
410412
throw new HTTPException(404, { res: await c.notFound() });
411413
}
412414

415+
// Delete all outgoing activities for this relay
416+
await tx
417+
.delete(pgTable("fedify_message_v2", {}))
418+
.where(sql`"message"->>'inbox' = ${relay.inboxUrl}`);
419+
413420
await fedCtx.sendActivity(
414421
{ username: relay.relayClientActor.owner.handle },
415422
[

0 commit comments

Comments
 (0)