From 52710f38107fd26628e138c418cbd7e3834e3778 Mon Sep 17 00:00:00 2001 From: fuyu <54523771+mfmfuyu@users.noreply.github.com> Date: Tue, 18 Feb 2020 17:53:52 +0900 Subject: [PATCH] =?UTF-8?q?=E7=AE=A1=E7=90=86=E8=80=85=E3=81=AF=E3=83=A2?= =?UTF-8?q?=E3=83=87=E3=83=AC=E3=83=BC=E3=82=BF=E3=83=BC=E3=81=AB=E5=A4=89?= =?UTF-8?q?=E6=9B=B4=E3=81=A7=E3=81=8D=E3=81=AA=E3=81=84=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=20(#5970)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 管理者をモデレーターに変更できないように * Change error message --- src/client/components/user-moderate-dialog.vue | 4 ++-- src/server/api/endpoints/admin/moderators/add.ts | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/client/components/user-moderate-dialog.vue b/src/client/components/user-moderate-dialog.vue index f45342564..61b8dd0ba 100644 --- a/src/client/components/user-moderate-dialog.vue +++ b/src/client/components/user-moderate-dialog.vue @@ -3,7 +3,7 @@
{{ $t('resetPassword') }} - {{ $t('moderator') }} + {{ $t('moderator') }} {{ $t('silence') }} {{ $t('suspend') }}
@@ -47,7 +47,7 @@ export default Vue.extend({ type: 'waiting', iconOnly: true }); - + this.$root.api('admin/reset-password', { userId: this.user.id, }).then(({ password }) => { diff --git a/src/server/api/endpoints/admin/moderators/add.ts b/src/server/api/endpoints/admin/moderators/add.ts index 71a214928..fd862a9a4 100644 --- a/src/server/api/endpoints/admin/moderators/add.ts +++ b/src/server/api/endpoints/admin/moderators/add.ts @@ -32,6 +32,10 @@ export default define(meta, async (ps) => { throw new Error('user not found'); } + if (user.isAdmin) { + throw new Error('cannot mark as moderator if admin user'); + } + await Users.update(user.id, { isModerator: true });