1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
<template>
<div class="ucnffhbtogqgscfmqcymwmmupoknpfsw">
<ui-card>
<div slot="title">{{ $t('verify-user') }}</div>
<section class="fit-top">
<ui-input v-model="verifyUsername" type="text">
<span slot="prefix">@</span>
</ui-input>
<ui-button @click="verifyUser" :disabled="verifying">{{ $t('verify') }}</ui-button>
</section>
</ui-card>
<ui-card>
<div slot="title">{{ $t('unverify-user') }}</div>
<section class="fit-top">
<ui-input v-model="unverifyUsername" type="text">
<span slot="prefix">@</span>
</ui-input>
<ui-button @click="unverifyUser" :disabled="unverifying">{{ $t('unverify') }}</ui-button>
</section>
</ui-card>
<ui-card>
<div slot="title">{{ $t('suspend-user') }}</div>
<section class="fit-top">
<ui-input v-model="suspendUsername" type="text">
<span slot="prefix">@</span>
</ui-input>
<ui-button @click="suspendUser" :disabled="suspending">{{ $t('suspend') }}</ui-button>
</section>
</ui-card>
<ui-card>
<div slot="title">{{ $t('unsuspend-user') }}</div>
<section class="fit-top">
<ui-input v-model="unsuspendUsername" type="text">
<span slot="prefix">@</span>
</ui-input>
<ui-button @click="unsuspendUser" :disabled="unsuspending">{{ $t('unsuspend') }}</ui-button>
</section>
</ui-card>
</div>
</template>
<script lang="ts">
import Vue from 'vue';
import i18n from '../../i18n';
import parseAcct from "../../../../misc/acct/parse";
export default Vue.extend({
i18n: i18n('admin/views/users.vue'),
data() {
return {
verifyUsername: null,
verifying: false,
unverifyUsername: null,
unverifying: false,
suspendUsername: null,
suspending: false,
unsuspendUsername: null,
unsuspending: false
};
},
methods: {
async verifyUser() {
this.verifying = true;
const process = async () => {
const user = await this.$root.api('users/show', parseAcct(this.verifyUsername));
await this.$root.api('admin/verify-user', { userId: user.id });
this.$root.alert({
type: 'success',
text: this.$t('verified')
});
};
await process().catch(e => {
this.$root.alert({
type: 'error',
text: e.toString()
});
});
this.verifying = false;
},
async unverifyUser() {
this.unverifying = true;
const process = async () => {
const user = await this.$root.api('users/show', parseAcct(this.unverifyUsername));
await this.$root.api('admin/unverify-user', { userId: user.id });
this.$root.alert({
type: 'success',
text: this.$t('unverified')
});
};
await process().catch(e => {
this.$root.alert({
type: 'error',
text: e.toString()
});
});
this.unverifying = false;
},
async suspendUser() {
this.suspending = true;
const process = async () => {
const user = await this.$root.api('users/show', parseAcct(this.suspendUsername));
await this.$root.api('admin/suspend-user', { userId: user.id });
this.$root.alert({
type: 'success',
text: this.$t('suspended')
});
};
await process().catch(e => {
this.$root.alert({
type: 'error',
text: e.toString()
});
});
this.suspending = false;
},
async unsuspendUser() {
this.unsuspending = true;
const process = async () => {
const user = await this.$root.api('users/show', parseAcct(this.unsuspendUsername));
await this.$root.api('admin/unsuspend-user', { userId: user.id });
this.$root.alert({
type: 'success',
text: this.$t('unsuspended')
});
};
await process().catch(e => {
this.$root.alert({
type: 'error',
text: e.toString()
});
});
this.unsuspending = false;
}
}
});
</script>
<style lang="stylus" scoped>
.ucnffhbtogqgscfmqcymwmmupoknpfsw
@media (min-width 500px)
padding 16px
</style>
|