Skip to content

Commit 4936248

Browse files
committed
Fix migration dashboard
Fix #98
1 parent 2696724 commit 4936248

File tree

2 files changed

+28
-5
lines changed

2 files changed

+28
-5
lines changed

CHANGES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ Version 0.4.5
66

77
To be released.
88

9+
- Fixed the bug where the migration dashboard had not been shown correctly
10+
when the aliases of the account contained an actor whose the server was
11+
unreachable. [[#98]]
12+
13+
[#98]: https://github.com/fedify-dev/hollo/issues/98
14+
915

1016
Version 0.4.4
1117
-------------

src/pages/accounts.tsx

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,19 @@ accounts.get("/:id/migrate", async (c) => {
441441
if (accountOwner == null) return c.notFound();
442442
const username = `@${accountOwner.handle}`;
443443
const aliases = await Promise.all(
444-
uniq(accountOwner.account.aliases).map(async (alias) => ({
445-
iri: alias,
446-
handle: await getActorHandle(new URL(alias)),
447-
})),
444+
uniq(accountOwner.account.aliases).map(async (alias) => {
445+
let handle: Awaited<ReturnType<typeof getActorHandle>> | null;
446+
try {
447+
handle = await getActorHandle(new URL(alias));
448+
} catch (e) {
449+
if (e instanceof TypeError) {
450+
handle = null;
451+
} else {
452+
throw e;
453+
}
454+
}
455+
return { iri: alias, handle };
456+
}),
448457
);
449458
const [{ followsCount }] = await db
450459
.select({ followsCount: count() })
@@ -497,7 +506,15 @@ accounts.get("/:id/migrate", async (c) => {
497506
<ul>
498507
{aliases.map(({ iri, handle }) => (
499508
<li>
500-
<tt>{handle}</tt> (<tt>{iri}</tt>)
509+
{handle == null ? (
510+
<>
511+
<tt>{iri}</tt> (The server is not available.)
512+
</>
513+
) : (
514+
<>
515+
<tt>{handle}</tt> (<tt>{iri}</tt>)
516+
</>
517+
)}
501518
</li>
502519
))}
503520
</ul>

0 commit comments

Comments
 (0)