Skip to content

Commit beae8d4

Browse files
sij411claude
andcommitted
Simplify parseRecipient return type and call sites
Remove redundant `id` field from parseRecipient and use explicit destructuring at call sites for clearer data flow. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 31cf60d commit beae8d4

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

test/smoke/harness/backdoor.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ function json(data: unknown, status = 200): Response {
1414
// actor URI and inbox URL directly.
1515
function parseRecipient(
1616
handle: string,
17-
): { id: URL; inboxId: URL; actorId: URL } {
17+
): { inboxId: URL; actorId: URL } {
1818
const [user, domain] = handle.split("@");
1919
const inboxId = new URL(`http://${domain}/users/${user}/inbox`);
2020
// Mastodon generates https:// actor URIs; use that as the canonical id
2121
const actorId = new URL(`https://${domain}/users/${user}`);
22-
return { id: actorId, inboxId, actorId };
22+
return { inboxId, actorId };
2323
}
2424

2525
export async function handleBackdoor(
@@ -56,7 +56,8 @@ export async function handleBackdoor(
5656
undefined as void,
5757
);
5858

59-
const { actorId, ...recipient } = parseRecipient(to);
59+
const { actorId, inboxId } = parseRecipient(to);
60+
const recipient = { id: actorId, inboxId };
6061

6162
const noteId = crypto.randomUUID();
6263
const note = new Note({
@@ -98,7 +99,8 @@ export async function handleBackdoor(
9899
undefined as void,
99100
);
100101

101-
const { actorId, ...recipient } = parseRecipient(target);
102+
const { actorId, inboxId } = parseRecipient(target);
103+
const recipient = { id: actorId, inboxId };
102104

103105
const follow = new Follow({
104106
id: new URL(
@@ -131,7 +133,8 @@ export async function handleBackdoor(
131133
undefined as void,
132134
);
133135

134-
const { actorId, ...recipient } = parseRecipient(target);
136+
const { actorId, inboxId } = parseRecipient(target);
137+
const recipient = { id: actorId, inboxId };
135138

136139
const undo = new Undo({
137140
id: new URL(

0 commit comments

Comments
 (0)