|
3 | 3 | Move, |
4 | 4 | type Object, |
5 | 5 | PUBLIC_COLLECTION, |
| 6 | + type Recipient, |
6 | 7 | Update, |
7 | 8 | exportJwk, |
8 | 9 | generateCryptoKeyPair, |
@@ -30,6 +31,7 @@ import { |
30 | 31 | type PostVisibility, |
31 | 32 | accountOwners, |
32 | 33 | accounts as accountsTable, |
| 34 | + follows, |
33 | 35 | } from "../schema.ts"; |
34 | 36 | import { extractCustomEmojis, formatText } from "../text.ts"; |
35 | 37 |
|
@@ -269,14 +271,35 @@ accounts.post("/:id/delete", async (c) => { |
269 | 271 | }); |
270 | 272 | if (accountOwner == null) return c.notFound(); |
271 | 273 | const fedCtx = federation.createContext(c.req.raw, undefined); |
| 274 | + const activity = new Delete({ |
| 275 | + actor: fedCtx.getActorUri(accountOwner.handle), |
| 276 | + to: PUBLIC_COLLECTION, |
| 277 | + object: await fedCtx.getActor(accountOwner.handle), |
| 278 | + }); |
272 | 279 | await fedCtx.sendActivity( |
273 | 280 | { handle: accountOwner.handle }, |
274 | 281 | "followers", |
275 | | - new Delete({ |
276 | | - actor: fedCtx.getActorUri(accountOwner.handle), |
277 | | - to: PUBLIC_COLLECTION, |
278 | | - object: await fedCtx.getActor(accountOwner.handle), |
279 | | - }), |
| 282 | + activity, |
| 283 | + { preferSharedInbox: true, excludeBaseUris: [fedCtx.url] }, |
| 284 | + ); |
| 285 | + const following = await db.query.follows.findMany({ |
| 286 | + with: { following: true }, |
| 287 | + where: eq(follows.followerId, accountId), |
| 288 | + }); |
| 289 | + await fedCtx.sendActivity( |
| 290 | + { handle: accountOwner.handle }, |
| 291 | + following.map( |
| 292 | + (f) => |
| 293 | + ({ |
| 294 | + id: new URL(f.following.iri), |
| 295 | + inboxId: new URL(f.following.inboxUrl), |
| 296 | + endpoints: |
| 297 | + f.following.sharedInboxUrl == null |
| 298 | + ? null |
| 299 | + : { sharedInbox: new URL(f.following.sharedInboxUrl) }, |
| 300 | + }) satisfies Recipient, |
| 301 | + ), |
| 302 | + activity, |
280 | 303 | { preferSharedInbox: true, excludeBaseUris: [fedCtx.url] }, |
281 | 304 | ); |
282 | 305 | await db.transaction(async (tx) => { |
|
0 commit comments