forked from FoundKeyGang/FoundKey
Resolve #2271
This commit is contained in:
parent
ad0d06c0d8
commit
9f4c6a3aef
4 changed files with 106 additions and 1 deletions
|
@ -926,6 +926,11 @@ desktop/views/pages/admin/admin.unsuspend-user.vue:
|
||||||
unsuspend: "凍結の解除"
|
unsuspend: "凍結の解除"
|
||||||
unsuspended: "凍結を解除しました"
|
unsuspended: "凍結を解除しました"
|
||||||
|
|
||||||
|
desktop/views/pages/admin/admin.verify-user.vue:
|
||||||
|
verify-user: "ユーザーの公式アカウント設定"
|
||||||
|
verify: "公式アカウントにする"
|
||||||
|
verified: "公式アカウントにしました"
|
||||||
|
|
||||||
desktop/views/pages/deck/deck.tl-column.vue:
|
desktop/views/pages/deck/deck.tl-column.vue:
|
||||||
is-media-only: "メディア投稿のみ"
|
is-media-only: "メディア投稿のみ"
|
||||||
is-media-view: "メディアビュー"
|
is-media-view: "メディアビュー"
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<header>%i18n:@verify-user%</header>
|
||||||
|
<input v-model="username" type="text" class="ui"/>
|
||||||
|
<button class="ui" @click="verifyUser" :disabled="verifying">%i18n:@verify%</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
import Vue from "vue";
|
||||||
|
import parseAcct from "../../../../../../misc/acct/parse";
|
||||||
|
|
||||||
|
export default Vue.extend({
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
username: null,
|
||||||
|
verifying: false
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async verifyUser() {
|
||||||
|
this.verifying = true;
|
||||||
|
|
||||||
|
const user = await (this as any).os.api(
|
||||||
|
"users/show",
|
||||||
|
parseAcct(this.username)
|
||||||
|
);
|
||||||
|
|
||||||
|
await (this as any).os.api("admin/verify-user", {
|
||||||
|
userId: user.id
|
||||||
|
});
|
||||||
|
|
||||||
|
this.verifying = false;
|
||||||
|
|
||||||
|
(this as any).os.apis.dialog({ text: "%i18n:@verified%" });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="stylus" scoped>
|
||||||
|
@import '~const.styl'
|
||||||
|
|
||||||
|
header
|
||||||
|
margin 10px 0
|
||||||
|
|
||||||
|
|
||||||
|
button
|
||||||
|
margin 16px 0
|
||||||
|
|
||||||
|
</style>
|
|
@ -15,6 +15,7 @@
|
||||||
<div v-if="page == 'users'">
|
<div v-if="page == 'users'">
|
||||||
<x-suspend-user/>
|
<x-suspend-user/>
|
||||||
<x-unsuspend-user/>
|
<x-unsuspend-user/>
|
||||||
|
<x-verify-user/>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="page == 'drive'"></div>
|
<div v-if="page == 'drive'"></div>
|
||||||
<div v-if="page == 'update'"></div>
|
<div v-if="page == 'update'"></div>
|
||||||
|
@ -27,12 +28,14 @@ import Vue from "vue";
|
||||||
import XDashboard from "./admin.dashboard.vue";
|
import XDashboard from "./admin.dashboard.vue";
|
||||||
import XSuspendUser from "./admin.suspend-user.vue";
|
import XSuspendUser from "./admin.suspend-user.vue";
|
||||||
import XUnsuspendUser from "./admin.unsuspend-user.vue";
|
import XUnsuspendUser from "./admin.unsuspend-user.vue";
|
||||||
|
import XVerifyUser from "./admin.verify-user.vue";
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
components: {
|
components: {
|
||||||
XDashboard,
|
XDashboard,
|
||||||
XSuspendUser,
|
XSuspendUser,
|
||||||
XUnsuspendUser
|
XUnsuspendUser,
|
||||||
|
XVerifyUser
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
46
src/server/api/endpoints/admin/verify-user.ts
Normal file
46
src/server/api/endpoints/admin/verify-user.ts
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
import $ from 'cafy';
|
||||||
|
import ID from '../../../../misc/cafy-id';
|
||||||
|
import getParams from '../../get-params';
|
||||||
|
import User from '../../../../models/user';
|
||||||
|
|
||||||
|
export const meta = {
|
||||||
|
desc: {
|
||||||
|
ja: '指定したユーザーを公式アカウントにします。',
|
||||||
|
en: 'Mark a user as verified.'
|
||||||
|
},
|
||||||
|
|
||||||
|
requireCredential: true,
|
||||||
|
requireAdmin: true,
|
||||||
|
|
||||||
|
params: {
|
||||||
|
userId: $.type(ID).note({
|
||||||
|
desc: {
|
||||||
|
ja: '対象のユーザーID',
|
||||||
|
en: 'The user ID which you want to verify'
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default (params: any) => new Promise(async (res, rej) => {
|
||||||
|
const [ps, psErr] = getParams(meta, params);
|
||||||
|
if (psErr) return rej(psErr);
|
||||||
|
|
||||||
|
const user = await User.findOne({
|
||||||
|
_id: ps.userId
|
||||||
|
});
|
||||||
|
|
||||||
|
if (user == null) {
|
||||||
|
return rej('user not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
await User.findOneAndUpdate({
|
||||||
|
_id: user._id
|
||||||
|
}, {
|
||||||
|
$set: {
|
||||||
|
isVerified: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
res();
|
||||||
|
});
|
Loading…
Reference in a new issue