diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2018-08-19 00:55:07 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-08-19 00:55:07 +0900 |
| commit | 0e45d0d47fca2f9cf2caf87a25442d3090bea2fb (patch) | |
| tree | 4591218074ce73b4f5d3be7582d76a170dc1b672 /src/server/api/endpoints/admin/unverify-user.ts | |
| parent | New translations ja.yml (Japanese (Kansai-ben)) (diff) | |
| parent | Merge pull request #2330 from syuilo/patch (diff) | |
| download | misskey-0e45d0d47fca2f9cf2caf87a25442d3090bea2fb.tar.gz misskey-0e45d0d47fca2f9cf2caf87a25442d3090bea2fb.tar.bz2 misskey-0e45d0d47fca2f9cf2caf87a25442d3090bea2fb.zip | |
Merge branch 'master' into l10n_master
Diffstat (limited to 'src/server/api/endpoints/admin/unverify-user.ts')
| -rw-r--r-- | src/server/api/endpoints/admin/unverify-user.ts | 46 |
1 files changed, 46 insertions, 0 deletions
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..34653cd78a --- /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 unverified.' + }, + + 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(); +}); |