From e014c91899ba899fe85ce23ee6d5b2074891a2d9 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 13 Apr 2023 13:50:17 +0900 Subject: [PATCH] =?UTF-8?q?enhance(frontend):=20=E3=83=A6=E3=83=BC?= =?UTF-8?q?=E3=82=B6=E3=83=BC=E3=83=A1=E3=83=8B=E3=83=A5=E3=83=BC=E3=81=8B?= =?UTF-8?q?=E3=82=89=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC=E3=83=A1=E3=83=A2?= =?UTF-8?q?=E3=82=92=E7=B7=A8=E9=9B=86=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/ja-JP.yml | 1 + .../frontend/src/scripts/get-user-menu.ts | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 83186dc729..5f5bcfd879 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -994,6 +994,7 @@ accountMigration: "アカウントの引っ越し" accountMoved: "このユーザーは新しいアカウントに引っ越しました:" forceShowAds: "常に広告を表示する" addMemo: "メモを追加" +editMemo: "メモを編集" _accountMigration: moveTo: "このアカウントを新しいアカウントに引っ越す" diff --git a/packages/frontend/src/scripts/get-user-menu.ts b/packages/frontend/src/scripts/get-user-menu.ts index fe941c77b2..6ff9fb63f1 100644 --- a/packages/frontend/src/scripts/get-user-menu.ts +++ b/packages/frontend/src/scripts/get-user-menu.ts @@ -98,6 +98,27 @@ export function getUserMenu(user: misskey.entities.UserDetailed, router: Router }); } + async function editMemo(): Promise { + const userDetailed = await os.api('users/show', { + userId: user.id, + }); + const { canceled, result } = await os.form(i18n.ts.editMemo, { + memo: { + type: 'string', + required: true, + multiline: true, + label: i18n.ts.memo, + default: userDetailed.memo, + }, + }); + if (canceled) return; + + os.apiWithDialog('users/update-memo', { + memo: result.memo, + userId: user.id, + }); + } + let menu = [{ icon: 'ti ti-at', text: i18n.ts.copyUsername, @@ -123,6 +144,12 @@ export function getUserMenu(user: misskey.entities.UserDetailed, router: Router os.post({ specified: user, initialText: `@${user.username} ` }); }, }, null, { + icon: 'ti ti-pencil', + text: i18n.ts.editMemo, + action: () => { + editMemo(); + }, + }, { type: 'parent', icon: 'ti ti-list', text: i18n.ts.addToList,