From 44c70df1a6e7d97d18f83929980f434804396bce Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Thu, 12 Oct 2023 00:23:20 +0200 Subject: [PATCH] [mastodon-client] Fix mentions in user bios --- packages/backend/src/server/api/mastodon/helpers/mfm.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/backend/src/server/api/mastodon/helpers/mfm.ts b/packages/backend/src/server/api/mastodon/helpers/mfm.ts index a232736f0..726e8feca 100644 --- a/packages/backend/src/server/api/mastodon/helpers/mfm.ts +++ b/packages/backend/src/server/api/mastodon/helpers/mfm.ts @@ -139,12 +139,15 @@ export class MfmHelpers { remoteUser.username === username && remoteUser.host === host, ); const localpart = `@${username}`; - const acct = host === config.domain ? localpart: node.props.acct; + const isLocal = host === config.domain || host === null; + const acct = isLocal ? localpart: node.props.acct; a.href = remoteUserInfo ? remoteUserInfo.url ? remoteUserInfo.url : remoteUserInfo.uri - : `${config.url}/${acct}`; + : isLocal + ? `${config.url}/${acct}` + : `https://${host}/${localpart}`; a.className = "u-url mention"; const span = doc.createElement("span"); span.textContent = username;