From 5e5069f2b704ad9bfe32316a647d865a22c2999a Mon Sep 17 00:00:00 2001 From: Dominik Braun Date: Mon, 13 Oct 2025 00:23:56 +0200 Subject: [PATCH] Copy username and instance easily --- .../components/account_header.tsx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/app/javascript/mastodon/features/account_timeline/components/account_header.tsx b/app/javascript/mastodon/features/account_timeline/components/account_header.tsx index 2bf636d060d..7b94078c735 100644 --- a/app/javascript/mastodon/features/account_timeline/components/account_header.tsx +++ b/app/javascript/mastodon/features/account_timeline/components/account_header.tsx @@ -371,6 +371,19 @@ export const AccountHeader: React.FC<{ }); }, [account]); + const handleCopyUsername = useCallback(() => { + if (!account) { + return; + } + + const isLocal = !account.acct.includes('@'); + const username = account.acct.split('@')[0]; + const domain = isLocal ? localDomain : account.acct.split('@')[1]; + const fullHandle = `@${username}@${domain}`; + + void navigator.clipboard.writeText(fullHandle); + }, [account]); + const suspended = account?.suspended; const isRemote = account?.acct !== account?.username; const remoteDomain = isRemote ? account?.acct.split('@')[1] : null; @@ -822,7 +835,11 @@ export const AccountHeader: React.FC<{

- + @{username} @{domain}