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.
 
 
 
 
 

25 lines
908 B

'use strict';
const { Boards, Accounts } = require(__dirname+'/../../db/')
, dynamicResponse = require(__dirname+'/../../lib/misc/dynamic.js');
module.exports = async (req, res) => {
const { __ } = res.locals;
//only a ROOT could do this, per the permission bypass in the controller
const deletingBoardOwner = req.body.checkedstaff.some(s => s === res.locals.board.owner);
await Promise.all([
Accounts.removeStaffBoard(req.body.checkedstaff, res.locals.board._id),
Boards.removeStaff(res.locals.board._id, req.body.checkedstaff),
deletingBoardOwner ? Accounts.removeOwnedBoard(res.locals.board.owner, res.locals.board._id) : void 0,
deletingBoardOwner ? Boards.setOwner(res.locals.board._id, null) : void 0,
]);
return dynamicResponse(req, res, 200, 'message', {
'title': __('Success'),
'message': __('Deleted staff'),
'redirect': `/${req.params.board}/manage/staff.html`,
});
};