モデレーター登録を解除できるように (#3876)
This commit is contained in:
parent
dd77a6194e
commit
1546160f6a
|
@ -1276,6 +1276,8 @@ admin/views/moderators.vue:
|
|||
title: "モデレーターの登録"
|
||||
add: "登録"
|
||||
added: "モデレーターを登録しました"
|
||||
remove: "解除"
|
||||
removed: "モデレーター登録を解除しました"
|
||||
|
||||
admin/views/emoji.vue:
|
||||
add-emoji:
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
<ui-input v-model="username" type="text">
|
||||
<span slot="prefix">@</span>
|
||||
</ui-input>
|
||||
<ui-button @click="add" :disabled="adding">{{ $t('add-moderator.add') }}</ui-button>
|
||||
<ui-button @click="add" :disabled="changing">{{ $t('add-moderator.add') }}</ui-button>
|
||||
<ui-button @click="remove" :disabled="changing">{{ $t('add-moderator.remove') }}</ui-button>
|
||||
</section>
|
||||
</ui-card>
|
||||
</div>
|
||||
|
@ -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;
|
||||
},
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue