diff --git a/locales/ja.yml b/locales/ja.yml index 08e437fbf7..9c3daf450f 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -915,6 +915,11 @@ desktop/views/pages/admin/admin.suspend-user.vue: suspend: "凍結" suspended: "凍結しました" +desktop/views/pages/admin/admin.unsuspend-user.vue: + unsuspend-user: "ユーザーの凍結の解除" + unsuspend: "凍結の解除" + unsuspended: "凍結を解除しました" + 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.unsuspend-user.vue b/src/client/app/desktop/views/pages/admin/admin.unsuspend-user.vue new file mode 100644 index 0000000000..8c6f63ce88 --- /dev/null +++ b/src/client/app/desktop/views/pages/admin/admin.unsuspend-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 12858cc6d0..b581bea465 100644 --- a/src/client/app/desktop/views/pages/admin/admin.vue +++ b/src/client/app/desktop/views/pages/admin/admin.vue @@ -14,6 +14,7 @@
+
@@ -25,11 +26,13 @@ import Vue from "vue"; import XDashboard from "./admin.dashboard.vue"; import XSuspendUser from "./admin.suspend-user.vue"; +import XUnsuspendUser from "./admin.unsuspend-user.vue"; export default Vue.extend({ components: { XDashboard, - XSuspendUser + XSuspendUser, + XUnsuspendUser }, data() { return { diff --git a/src/server/api/endpoints/admin/unsuspend-user.ts b/src/server/api/endpoints/admin/unsuspend-user.ts new file mode 100644 index 0000000000..8409bd1b76 --- /dev/null +++ b/src/server/api/endpoints/admin/unsuspend-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: 'Unsuspend a user.' + }, + + requireCredential: true, + requireAdmin: true, + + params: { + userId: $.type(ID).note({ + desc: { + ja: '対象のユーザーID', + en: 'The user ID which you want to unsuspend' + } + }), + } +}; + +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: { + isSuspended: false + } + }); + + res(); +});