From 485173c9156aa3c7b33dfc9f1bff6abd7e1bb571 Mon Sep 17 00:00:00 2001 From: Mar0xy Date: Mon, 25 Sep 2023 02:56:43 +0200 Subject: [PATCH] fix: user url --- packages/megalodon/src/misskey/api_client.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/megalodon/src/misskey/api_client.ts b/packages/megalodon/src/misskey/api_client.ts index aa0cabcff..364f08f77 100644 --- a/packages/megalodon/src/misskey/api_client.ts +++ b/packages/megalodon/src/misskey/api_client.ts @@ -71,12 +71,12 @@ namespace MisskeyAPI { export const user = (u: Entity.User, host: string | null = null): MegalodonEntity.Account => { host ? host = host.replace("https://", "") : null; let acct = u.username - if (u.host) { - acct = `${u.username}@${u.host}` - } if (host) { acct = `${u.username}@${host}` } + if (u.host) { + acct = `${u.username}@${u.host}` + } return { id: u.id, username: u.username, @@ -92,7 +92,7 @@ namespace MisskeyAPI { following_count: 0, statuses_count: 0, note: '', - url: acct, + url: u.host ? `https://${u.host}/@${u.username}` : host ? `https://${host}/@${u.username}` : acct, avatar: u.avatarUrl, avatar_static: u.avatarColor, header: '', @@ -107,12 +107,12 @@ namespace MisskeyAPI { export const userDetail = (u: Entity.UserDetail, host: string | null = null): MegalodonEntity.Account => { host ? host = host.replace("https://", "") : null; let acct = u.username - if (u.host) { - acct = `${u.username}@${u.host}` - } if (host) { acct = `${u.username}@${host}` } + if (u.host) { + acct = `${u.username}@${u.host}` + } return { id: u.id, username: u.username, @@ -128,7 +128,7 @@ namespace MisskeyAPI { following_count: u.followingCount, statuses_count: u.notesCount, note: u.description ? u.description : '', - url: acct, + url: u.host ? `https://${u.host}/@${u.username}` : host ? `https://${host}/@${u.username}` : acct, avatar: u.avatarUrl, avatar_static: u.avatarColor, header: u.bannerUrl,