Resolve #2293
This commit is contained in:
parent
bc3f5e0d78
commit
11bb1608cf
4 changed files with 105 additions and 0 deletions
|
@ -931,6 +931,11 @@ desktop/views/pages/admin/admin.verify-user.vue:
|
|||
verify: "公式アカウントにする"
|
||||
verified: "公式アカウントにしました"
|
||||
|
||||
desktop/views/pages/admin/admin.unverify-user.vue:
|
||||
unverify-user: "ユーザーの公式アカウント解除"
|
||||
unverify: "公式アカウントを解除する"
|
||||
unverified: "公式アカウントを解除しました"
|
||||
|
||||
desktop/views/pages/admin/admin.notes-chart.vue:
|
||||
title: "投稿"
|
||||
local: "ローカル"
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
<template>
|
||||
<div class="card">
|
||||
<header>%i18n:@unverify-user%</header>
|
||||
<input v-model="username" type="text" class="ui"/>
|
||||
<button class="ui" @click="unverifyUser" :disabled="unverifying">%i18n:@unverify%</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
import parseAcct from "../../../../../../misc/acct/parse";
|
||||
|
||||
export default Vue.extend({
|
||||
data() {
|
||||
return {
|
||||
username: null,
|
||||
unverifying: false
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
async unverifyUser() {
|
||||
this.unverifying = true;
|
||||
|
||||
const user = await (this as any).os.api(
|
||||
"users/show",
|
||||
parseAcct(this.username)
|
||||
);
|
||||
|
||||
await (this as any).os.api("admin/unverify-user", {
|
||||
userId: user.id
|
||||
});
|
||||
|
||||
this.unverifying = false;
|
||||
|
||||
(this as any).os.apis.dialog({ text: "%i18n:@unverified%" });
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
@import '~const.styl'
|
||||
|
||||
header
|
||||
margin 10px 0
|
||||
|
||||
|
||||
button
|
||||
margin 16px 0
|
||||
|
||||
</style>
|
|
@ -18,6 +18,7 @@
|
|||
<x-suspend-user/>
|
||||
<x-unsuspend-user/>
|
||||
<x-verify-user/>
|
||||
<x-unverify-user/>
|
||||
</div>
|
||||
<div v-if="page == 'drive'"></div>
|
||||
<div v-if="page == 'update'"></div>
|
||||
|
@ -31,6 +32,7 @@ import XDashboard from "./admin.dashboard.vue";
|
|||
import XSuspendUser from "./admin.suspend-user.vue";
|
||||
import XUnsuspendUser from "./admin.unsuspend-user.vue";
|
||||
import XVerifyUser from "./admin.verify-user.vue";
|
||||
import XUnverifyUser from "./admin.unverify-user.vue";
|
||||
import XUsersChart from "./admin.users-chart.vue";
|
||||
import XNotesChart from "./admin.notes-chart.vue";
|
||||
|
||||
|
@ -40,6 +42,7 @@ export default Vue.extend({
|
|||
XSuspendUser,
|
||||
XUnsuspendUser,
|
||||
XVerifyUser,
|
||||
XUnverifyUser,
|
||||
XUsersChart,
|
||||
XNotesChart
|
||||
},
|
||||
|
|
46
src/server/api/endpoints/admin/unverify-user.ts
Normal file
46
src/server/api/endpoints/admin/unverify-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 vunerified.'
|
||||
},
|
||||
|
||||
requireCredential: true,
|
||||
requireAdmin: true,
|
||||
|
||||
params: {
|
||||
userId: $.type(ID).note({
|
||||
desc: {
|
||||
ja: '対象のユーザーID',
|
||||
en: 'The user ID which you want to unverify'
|
||||
}
|
||||
}),
|
||||
}
|
||||
};
|
||||
|
||||
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: false
|
||||
}
|
||||
});
|
||||
|
||||
res();
|
||||
});
|
Loading…
Reference in a new issue