jschan - Anonymous imageboard software. Classic look, modern features and feel. Works without JavaScript and supports Tor, I2P, Lokinet, etc.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

37 lines
825 B

'use strict';
const removeBans = require(__dirname+'/../../models/forms/removebans.js');
module.exports = async (req, res, next) => {
//keep this for later in case i add other options to unbans
const errors = [];
if (!req.body.checkedbans || req.body.checkedbans.length === 0 || req.body.checkedbans.length > 10) {
errors.push('Must select 1-10 bans')
}
const redirect = req.params.board ? `/${req.params.board}/manage.html` : '/globalmanage.html';
if (errors.length > 0) {
return res.status(400).render('message', {
'title': 'Bad request',
'errors': errors,
redirect
});
}
let amount = 0;
try {
amount = await removeBans(req, res, next);
} catch (err) {
return next(err);
}
return res.render('message', {
'title': 'Success',
'message': `Removed ${amount} bans`,
redirect
});
}