From 1546160f6a064381c11b6b13a266c29f9072dfdb Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Fri, 11 Jan 2019 08:11:24 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=A2=E3=83=87=E3=83=AC=E3=83=BC=E3=82=BF?= =?UTF-8?q?=E3=83=BC=E7=99=BB=E9=8C=B2=E3=82=92=E8=A7=A3=E9=99=A4=E3=81=A7?= =?UTF-8?q?=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=20(#3876)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/ja-JP.yml | 2 ++ src/client/app/admin/views/moderators.vue | 31 ++++++++++++++++++++--- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index c91548d78a..d1e515e819 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -1276,6 +1276,8 @@ admin/views/moderators.vue: title: "モデレーターの登録" add: "登録" added: "モデレーターを登録しました" + remove: "解除" + removed: "モデレーター登録を解除しました" admin/views/emoji.vue: add-emoji: diff --git a/src/client/app/admin/views/moderators.vue b/src/client/app/admin/views/moderators.vue index 296c553bb7..6391aef240 100644 --- a/src/client/app/admin/views/moderators.vue +++ b/src/client/app/admin/views/moderators.vue @@ -6,7 +6,8 @@ @ - {{ $t('add-moderator.add') }} + {{ $t('add-moderator.add') }} + {{ $t('add-moderator.remove') }} @@ -23,13 +24,13 @@ export default Vue.extend({ data() { return { username: '', - adding: false + changing: false }; }, methods: { async add() { - this.adding = true; + this.changing = true; const process = async () => { const user = await this.$root.api('users/show', parseAcct(this.username)); @@ -47,7 +48,29 @@ export default Vue.extend({ }); }); - this.adding = false; + this.changing = false; + }, + + async remove() { + this.changing = true; + + const process = async () => { + const user = await this.$root.api('users/show', parseAcct(this.username)); + await this.$root.api('admin/moderators/remove', { userId: user.id }); + this.$root.dialog({ + type: 'success', + text: this.$t('add-moderator.removed') + }); + }; + + await process().catch(e => { + this.$root.dialog({ + type: 'error', + text: e.toString() + }); + }); + + this.changing = false; }, } });