From 958b97a50ccd99e01c8b03ba83b26bea182e0817 Mon Sep 17 00:00:00 2001 From: Mar0xy Date: Mon, 27 Nov 2023 22:17:03 +0100 Subject: [PATCH] upd: add ability to open remote profile in user dropdown Closes transfem-org/Sharkey#176 --- locales/en-US.yml | 1 + locales/index.d.ts | 1 + locales/ja-JP.yml | 1 + packages/frontend/src/scripts/get-user-menu.ts | 8 +++++++- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/locales/en-US.yml b/locales/en-US.yml index 7f30959c12..28751cb7ef 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -55,6 +55,7 @@ addToAntenna: "Add to antenna" sendMessage: "Send a message" copyRSS: "Copy RSS" copyUsername: "Copy username" +openRemoteProfile: "Open remote profile" copyUserId: "Copy user ID" copyNoteId: "Copy note ID" copyFileId: "Copy file ID" diff --git a/locales/index.d.ts b/locales/index.d.ts index 8356046a6b..97fdd0f25e 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -58,6 +58,7 @@ export interface Locale { "sendMessage": string; "copyRSS": string; "copyUsername": string; + "openRemoteProfile": string; "copyUserId": string; "copyNoteId": string; "copyFileId": string; diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 25ee9b1889..16d8d31694 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -55,6 +55,7 @@ addToAntenna: "アンテナに追加" sendMessage: "メッセージを送信" copyRSS: "RSSをコピー" copyUsername: "ユーザー名をコピー" +openRemoteProfile: "リモートプロファイルを開く" copyUserId: "ユーザーIDをコピー" copyNoteId: "ノートIDをコピー" copyFileId: "ファイルIDをコピー" diff --git a/packages/frontend/src/scripts/get-user-menu.ts b/packages/frontend/src/scripts/get-user-menu.ts index c8942314b2..41d0df1b72 100644 --- a/packages/frontend/src/scripts/get-user-menu.ts +++ b/packages/frontend/src/scripts/get-user-menu.ts @@ -176,7 +176,13 @@ export function getUserMenu(user: Misskey.entities.UserDetailed, router: Router const canonical = user.host === null ? `@${user.username}` : `@${user.username}@${toUnicode(user.host)}`; copyToClipboard(`${url}/${canonical}`); }, - }, { + }, ...(user.host ? [{ + icon: 'ph-share ph-bold ph-lg', + text: i18n.ts.openRemoteProfile, + action: () => { + open(`${user.uri}`, '_blank'); + }, + }] : []), { icon: 'ph-envelope ph-bold ph-lg', text: i18n.ts.sendMessage, action: () => {