diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2023-11-14 07:58:18 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2023-11-14 07:58:18 +0900 |
| commit | 2d2eefe3d44ad7118bbe39d5acb1301ed802522e (patch) | |
| tree | d961b9b0ab3bed7eed1efe0470b61eb381add724 /packages/frontend/src/scripts | |
| parent | docs: Update Code of Conduct to version 2.1 (#12150) (diff) | |
| download | sharkey-2d2eefe3d44ad7118bbe39d5acb1301ed802522e.tar.gz sharkey-2d2eefe3d44ad7118bbe39d5acb1301ed802522e.tar.bz2 sharkey-2d2eefe3d44ad7118bbe39d5acb1301ed802522e.zip | |
feat: メールアドレスを使用してユーザー名を割り出す機能
Resolve #10158
Diffstat (limited to 'packages/frontend/src/scripts')
| -rw-r--r-- | packages/frontend/src/scripts/lookup-user.ts | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/packages/frontend/src/scripts/lookup-user.ts b/packages/frontend/src/scripts/lookup-user.ts index 3dbc03f777..a35fe898e4 100644 --- a/packages/frontend/src/scripts/lookup-user.ts +++ b/packages/frontend/src/scripts/lookup-user.ts @@ -39,3 +39,26 @@ export async function lookupUser() { notFound(); }); } + +export async function lookupUserByEmail() { + const { canceled, result } = await os.inputText({ + title: i18n.ts.emailAddress, + type: 'email', + }); + if (canceled) return; + + try { + const user = await os.apiWithDialog('admin/accounts/find-by-email', { email: result }); + + os.pageWindow(`/admin/user/${user.id}`); + } catch (err) { + if (err.code === 'USER_NOT_FOUND') { + os.alert({ + type: 'error', + text: i18n.ts.noSuchUser, + }); + } else { + throw err; + } + } +} |