mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-26 07:35:16 +00:00
管理者はモデレーターに変更できないように (#5970)
* 管理者をモデレーターに変更できないように * Change error message
This commit is contained in:
parent
a54de07260
commit
52710f3810
2 changed files with 6 additions and 2 deletions
|
@ -3,7 +3,7 @@
|
||||||
<template #header><mk-user-name :user="user"/></template>
|
<template #header><mk-user-name :user="user"/></template>
|
||||||
<div class="vrcsvlkm">
|
<div class="vrcsvlkm">
|
||||||
<mk-button @click="resetPassword()" primary>{{ $t('resetPassword') }}</mk-button>
|
<mk-button @click="resetPassword()" primary>{{ $t('resetPassword') }}</mk-button>
|
||||||
<mk-switch v-if="$store.state.i.isAdmin" @change="toggleModerator()" v-model="moderator">{{ $t('moderator') }}</mk-switch>
|
<mk-switch v-if="$store.state.i.isAdmin && !user.isAdmin" @change="toggleModerator()" v-model="moderator">{{ $t('moderator') }}</mk-switch>
|
||||||
<mk-switch @change="toggleSilence()" v-model="silenced">{{ $t('silence') }}</mk-switch>
|
<mk-switch @change="toggleSilence()" v-model="silenced">{{ $t('silence') }}</mk-switch>
|
||||||
<mk-switch @change="toggleSuspend()" v-model="suspended">{{ $t('suspend') }}</mk-switch>
|
<mk-switch @change="toggleSuspend()" v-model="suspended">{{ $t('suspend') }}</mk-switch>
|
||||||
</div>
|
</div>
|
||||||
|
@ -47,7 +47,7 @@ export default Vue.extend({
|
||||||
type: 'waiting',
|
type: 'waiting',
|
||||||
iconOnly: true
|
iconOnly: true
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$root.api('admin/reset-password', {
|
this.$root.api('admin/reset-password', {
|
||||||
userId: this.user.id,
|
userId: this.user.id,
|
||||||
}).then(({ password }) => {
|
}).then(({ password }) => {
|
||||||
|
|
|
@ -32,6 +32,10 @@ export default define(meta, async (ps) => {
|
||||||
throw new Error('user not found');
|
throw new Error('user not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (user.isAdmin) {
|
||||||
|
throw new Error('cannot mark as moderator if admin user');
|
||||||
|
}
|
||||||
|
|
||||||
await Users.update(user.id, {
|
await Users.update(user.id, {
|
||||||
isModerator: true
|
isModerator: true
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue