Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
234 changes: 77 additions & 157 deletions deno.lock

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions federation/actor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,38 @@ test("getAccountActor serves a suspended stub for banned accounts", async () =>
assert.equal(tempActor.name?.toString(), "AP Banned");
});
});

test("getAccountActor exposes account migration aliases", async () => {
await withRollback(async (tx) => {
const { account } = await insertAccountWithActor(tx, {
username: "apaliases",
name: "AP Aliases",
email: "apaliases@example.com",
});
await tx.update(actorTable)
.set({
aliases: [
"https://old.example/users/apaliases",
"https://older.example/users/apaliases",
],
})
.where(eq(actorTable.accountId, account.id));
const refreshed = await tx.query.accountTable.findFirst({
where: { id: account.id },
with: {
actor: true,
avatarMedium: true,
emails: true,
links: { orderBy: { index: "asc" } },
},
});
Comment thread
dahlia marked this conversation as resolved.
assert.ok(refreshed != null);

const actor = await getAccountActor(createFedCtx(tx), refreshed, []);

assert.deepEqual(actor.aliasIds.map((alias) => alias.href), [
"https://old.example/users/apaliases",
"https://older.example/users/apaliases",
]);
});
});
1 change: 1 addition & 0 deletions federation/person.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export async function getAccountActor(
followers: ctx.getFollowersUri(identifier),
featured: ctx.getFeaturedUri(identifier),
url: new URL(`/@${account.username}`, ctx.canonicalOrigin),
aliases: account.actor.aliases.map((alias) => new URL(alias)),
Comment thread
dahlia marked this conversation as resolved.
Comment thread
dahlia marked this conversation as resolved.
};
if (isActorBanned(account.actor)) {
return new Person({
Expand Down
Loading
Loading