diff --git a/locales/ja.yml b/locales/ja.yml index 13ccce048..37d6ab5c4 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -926,6 +926,11 @@ desktop/views/pages/admin/admin.unsuspend-user.vue: unsuspend: "凍結の解除" unsuspended: "凍結を解除しました" +desktop/views/pages/admin/admin.verify-user.vue: + verify-user: "ユーザーの公式アカウント設定" + verify: "公式アカウントにする" + verified: "公式アカウントにしました" + desktop/views/pages/deck/deck.tl-column.vue: is-media-only: "メディア投稿のみ" is-media-view: "メディアビュー" diff --git a/src/client/app/desktop/views/pages/admin/admin.verify-user.vue b/src/client/app/desktop/views/pages/admin/admin.verify-user.vue new file mode 100644 index 000000000..c9a81fae9 --- /dev/null +++ b/src/client/app/desktop/views/pages/admin/admin.verify-user.vue @@ -0,0 +1,51 @@ + + + + + diff --git a/src/client/app/desktop/views/pages/admin/admin.vue b/src/client/app/desktop/views/pages/admin/admin.vue index b581bea46..29b6093c9 100644 --- a/src/client/app/desktop/views/pages/admin/admin.vue +++ b/src/client/app/desktop/views/pages/admin/admin.vue @@ -15,6 +15,7 @@
+
@@ -27,12 +28,14 @@ import Vue from "vue"; 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"; export default Vue.extend({ components: { XDashboard, XSuspendUser, - XUnsuspendUser + XUnsuspendUser, + XVerifyUser }, data() { return { diff --git a/src/server/api/endpoints/admin/verify-user.ts b/src/server/api/endpoints/admin/verify-user.ts new file mode 100644 index 000000000..5b826eb1c --- /dev/null +++ b/src/server/api/endpoints/admin/verify-user.ts @@ -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(); +});