2019-01-19 03:16:48 -07:00
|
|
|
import $ from 'cafy';
|
|
|
|
import ID, { transform } from '../../../../misc/cafy-id';
|
|
|
|
import define from '../../define';
|
|
|
|
import AbuseUserReport from '../../../../models/abuse-user-report';
|
|
|
|
|
|
|
|
export const meta = {
|
|
|
|
requireCredential: true,
|
|
|
|
requireModerator: true,
|
|
|
|
|
|
|
|
params: {
|
|
|
|
reportId: {
|
|
|
|
validator: $.type(ID),
|
|
|
|
transform: transform
|
|
|
|
},
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-02-21 19:46:58 -07:00
|
|
|
export default define(meta, async (ps) => {
|
2019-01-19 03:16:48 -07:00
|
|
|
const report = await AbuseUserReport.findOne({
|
|
|
|
_id: ps.reportId
|
|
|
|
});
|
|
|
|
|
|
|
|
if (report == null) {
|
2019-02-21 19:46:58 -07:00
|
|
|
throw new Error('report not found');
|
2019-01-19 03:16:48 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
await AbuseUserReport.remove({
|
|
|
|
_id: report._id
|
|
|
|
});
|
|
|
|
|
2019-02-21 19:46:58 -07:00
|
|
|
return;
|
|
|
|
});
|