From 44d440649f7c3e14976144f30a49cc11f88e0fb3 Mon Sep 17 00:00:00 2001 From: Scott Feeney Date: Sat, 13 Jul 2024 01:15:01 -0700 Subject: [PATCH] Include domain when copying local user's handle Fixes #596 --- src/components/account-info.jsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/account-info.jsx b/src/components/account-info.jsx index bf40243b..0e2fea35 100644 --- a/src/components/account-info.jsx +++ b/src/components/account-info.jsx @@ -568,9 +568,9 @@ function AccountInfo({ { - const handle = `@${acct}`; + const handleWithInstance = acct.includes('@') ? `@${acct}` : `@${acct}@${instance}`; try { - navigator.clipboard.writeText(handle); + navigator.clipboard.writeText(handleWithInstance); showToast('Handle copied'); } catch (e) { console.error(e); @@ -924,6 +924,8 @@ function RelatedActions({ const [currentInfo, setCurrentInfo] = useState(null); const [isSelf, setIsSelf] = useState(false); + const acctWithInstance = acct.includes('@') ? acct : `${acct}@${instance}`; + useEffect(() => { if (info) { const currentAccount = getCurrentAccountID(); @@ -1205,7 +1207,7 @@ function RelatedActions({ )} { - const handle = `@${currentInfo?.acct || acct}`; + const handle = `@${currentInfo?.acct || acctWithInstance}`; try { navigator.clipboard.writeText(handle); showToast('Handle copied'); @@ -1220,7 +1222,7 @@ function RelatedActions({ Copy handle
- @{currentInfo?.acct || acct} + @{currentInfo?.acct || acctWithInstance}