Skip to content

Commit 00f4099

Browse files
committed
Use username instead of handle
1 parent 53926aa commit 00f4099

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

src/api/v1/accounts.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ app.patch(
150150
const fmtOpts = {
151151
url: fedCtx.url,
152152
contextLoader: fedCtx.contextLoader,
153-
documentLoader: await fedCtx.getDocumentLoader(owner),
153+
documentLoader: await fedCtx.getDocumentLoader({
154+
username: account.handle,
155+
}),
154156
};
155157
const fields = Object.entries(owner.fields);
156158
const fieldHtmls: [string, string][] = [];
@@ -319,7 +321,9 @@ app.get(
319321
? fedCtx
320322
: {
321323
contextLoader: fedCtx.contextLoader,
322-
documentLoader: await fedCtx.getDocumentLoader(owner),
324+
documentLoader: await fedCtx.getDocumentLoader({
325+
username: owner.handle,
326+
}),
323327
};
324328
const actor = await lookupObject(acct, options);
325329
if (!isActor(actor)) return c.json({ error: "Record not found" }, 404);
@@ -386,7 +390,9 @@ app.get(
386390
const fedCtx = federation.createContext(c.req.raw, undefined);
387391
const options = {
388392
contextLoader: fedCtx.contextLoader,
389-
documentLoader: await fedCtx.getDocumentLoader(exactMatch),
393+
documentLoader: await fedCtx.getDocumentLoader({
394+
username: exactMatch.handle,
395+
}),
390396
};
391397
const actor = await lookupObject(query.q, options);
392398
if (isActor(actor)) await persistAccount(db, actor, options);

src/api/v1/statuses.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ app.post(
132132
const fmtOpts = {
133133
url: fedCtx.url,
134134
contextLoader: fedCtx.contextLoader,
135-
documentLoader: await fedCtx.getDocumentLoader(owner),
135+
documentLoader: await fedCtx.getDocumentLoader({
136+
username: owner.handle,
137+
}),
136138
};
137139
const data = c.req.valid("json");
138140
const handle = owner.handle;
@@ -278,7 +280,9 @@ app.put(
278280
const fmtOpts = {
279281
url: fedCtx.url,
280282
contextLoader: fedCtx.contextLoader,
281-
documentLoader: await fedCtx.getDocumentLoader(owner),
283+
documentLoader: await fedCtx.getDocumentLoader({
284+
username: owner.handle,
285+
}),
282286
};
283287
const content =
284288
data.status == null ? null : await formatText(db, data.status, fmtOpts);

src/api/v2/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ app.get(
7878
: [];
7979
const fedCtx = federation.createContext(c.req.raw, undefined);
8080
const options = {
81-
documentLoader: await fedCtx.getDocumentLoader(owner),
81+
documentLoader: await fedCtx.getDocumentLoader({
82+
username: owner.handle,
83+
}),
8284
contextLoader: fedCtx.contextLoader,
8385
};
8486
let resolved: Object | null = null;

src/pages/accounts.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,9 @@ accounts.post("/:id", async (c) => {
241241
const fmtOpts = {
242242
url: fedCtx.url,
243243
contextLoader: fedCtx.contextLoader,
244-
documentLoader: await fedCtx.getDocumentLoader(accountOwner),
244+
documentLoader: await fedCtx.getDocumentLoader({
245+
username: accountOwner.handle,
246+
}),
245247
};
246248
const bioResult = await formatText(db, bio ?? "", fmtOpts);
247249
const nameEmojis = await extractCustomEmojis(db, name);

0 commit comments

Comments
 (0)