summaryrefslogtreecommitdiff
path: root/packages/frontend/src/scripts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-03-01 10:20:03 +0900
committerGitHub <noreply@github.com>2023-03-01 10:20:03 +0900
commit1c5291f8185651c231903129ee7c1cee263f9f03 (patch)
tree36668447b343dc4c50222390761fd73d143278e9 /packages/frontend/src/scripts
parentenhance(client): ノートの操作部をホバー時のみ表示するオプ... (diff)
downloadmisskey-1c5291f8185651c231903129ee7c1cee263f9f03.tar.gz
misskey-1c5291f8185651c231903129ee7c1cee263f9f03.tar.bz2
misskey-1c5291f8185651c231903129ee7c1cee263f9f03.zip
feat: 時限ロール (#10145)
* feat: 時限ロール * クライアントから期限を確認できるように * リファクタとか * fix test * fix test * fix test * clean up
Diffstat (limited to 'packages/frontend/src/scripts')
-rw-r--r--packages/frontend/src/scripts/get-user-menu.ts28
1 files changed, 26 insertions, 2 deletions
diff --git a/packages/frontend/src/scripts/get-user-menu.ts b/packages/frontend/src/scripts/get-user-menu.ts
index 6c6baf8266..5170ca4c8c 100644
--- a/packages/frontend/src/scripts/get-user-menu.ts
+++ b/packages/frontend/src/scripts/get-user-menu.ts
@@ -143,8 +143,32 @@ export function getUserMenu(user: misskey.entities.UserDetailed, router: Router
return roles.filter(r => r.target === 'manual').map(r => ({
text: r.name,
- action: () => {
- os.apiWithDialog('admin/roles/assign', { roleId: r.id, userId: user.id });
+ action: async () => {
+ const { canceled, result: period } = await os.select({
+ title: i18n.ts.period,
+ items: [{
+ value: 'indefinitely', text: i18n.ts.indefinitely,
+ }, {
+ value: 'oneHour', text: i18n.ts.oneHour,
+ }, {
+ value: 'oneDay', text: i18n.ts.oneDay,
+ }, {
+ value: 'oneWeek', text: i18n.ts.oneWeek,
+ }, {
+ value: 'oneMonth', text: i18n.ts.oneMonth,
+ }],
+ default: 'indefinitely',
+ });
+ if (canceled) return;
+
+ const expiresAt = period === 'indefinitely' ? null
+ : period === 'oneHour' ? Date.now() + (1000 * 60 * 60)
+ : period === 'oneDay' ? Date.now() + (1000 * 60 * 60 * 24)
+ : period === 'oneWeek' ? Date.now() + (1000 * 60 * 60 * 24 * 7)
+ : period === 'oneMonth' ? Date.now() + (1000 * 60 * 60 * 24 * 30)
+ : null;
+
+ os.apiWithDialog('admin/roles/assign', { roleId: r.id, userId: user.id, expiresAt });
},
}));
},