diff --git a/locales/ja.yml b/locales/ja.yml index c861d32595..55c37fab67 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -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: "ローカル" diff --git a/src/client/app/desktop/views/pages/admin/admin.unverify-user.vue b/src/client/app/desktop/views/pages/admin/admin.unverify-user.vue new file mode 100644 index 0000000000..72962870d9 --- /dev/null +++ b/src/client/app/desktop/views/pages/admin/admin.unverify-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 d1e12eeb14..7c1dace78c 100644 --- a/src/client/app/desktop/views/pages/admin/admin.vue +++ b/src/client/app/desktop/views/pages/admin/admin.vue @@ -18,6 +18,7 @@ +
@@ -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 }, diff --git a/src/server/api/endpoints/admin/unverify-user.ts b/src/server/api/endpoints/admin/unverify-user.ts new file mode 100644 index 0000000000..d75f3674bf --- /dev/null +++ b/src/server/api/endpoints/admin/unverify-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 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(); +});