mirror of https://gitgud.io/fatchan/jschan.git
parent
279b3c2dd5
commit
335b38f9cc
18 changed files with 118 additions and 98 deletions
@ -1,35 +1,9 @@ |
||||
'use strict'; |
||||
|
||||
const uuidv4 = require('uuid/v4') |
||||
, path = require('path') |
||||
, Posts = require(__dirname+'/../../db-models/posts.js') |
||||
const Posts = require(__dirname+'/../../db-models/posts.js'); |
||||
|
||||
module.exports = async (req, res, next, numFiles) => { |
||||
module.exports = async (req, res, next) => { |
||||
|
||||
// get the post that we are trying to edit
|
||||
let post; |
||||
try { |
||||
post = await Posts.getPost(req.params.board, req.body.id, true); |
||||
} catch (err) { |
||||
return next(err); |
||||
} |
||||
|
||||
if (!thread || thread.thread != null) { |
||||
throw { |
||||
'status': 400, |
||||
'message': { |
||||
'title': 'Bad request', |
||||
'message': 'Post does not exist.', |
||||
'redirect': redirect |
||||
} |
||||
}; |
||||
} |
||||
|
||||
// sticky, lock, sage, spoiler, etc
|
||||
for (let i = 0; i < req.body.actions.length; i++) { |
||||
//TODO
|
||||
} |
||||
|
||||
return ``; |
||||
throw new Error('Not implemented'); |
||||
|
||||
} |
||||
|
@ -0,0 +1,13 @@ |
||||
'use strict'; |
||||
|
||||
const Bans = require(__dirname+'/../../db-models/bans.js') |
||||
, { ObjectId } = require('mongodb'); |
||||
|
||||
module.exports = async (req, res, next) => { |
||||
|
||||
const banIds = req.body.checkedbans.map(ObjectId); |
||||
const removedBans = await Bans.removeMany(req.params.board, banIds).then(result => result.deletedCount); |
||||
|
||||
return `Removed ${removedBans} bans`; |
||||
|
||||
} |
@ -1,16 +1,18 @@ |
||||
include ./post.pug |
||||
|
||||
mixin ban(ban) |
||||
if ban.board |
||||
div Board: #[a(href=`/${ban.board}`) /#{ban.board}/] |
||||
else |
||||
div Global ban. |
||||
div Reason: #{ban.reason} |
||||
div Issuer: #{ban.issuer} |
||||
div Date: #{ban.date} |
||||
div Expiry: #{ban.expireAt} |
||||
if ban.post |
||||
span Post: |
||||
section.thread |
||||
+post(ban.post, false) |
||||
.ban |
||||
input.post-check(type='checkbox', name='checkedbans[]' value=ban._id) |
||||
if ban.board |
||||
div Board: #[a(href=`/${ban.board}`) /#{ban.board}/] |
||||
else |
||||
div Global ban. |
||||
div Reason: #{ban.reason} |
||||
div Issuer: #{ban.issuer} |
||||
div Date: #{ban.date} |
||||
div Expiry: #{ban.expireAt} |
||||
if ban.post |
||||
span Post: |
||||
section.thread |
||||
+post(ban.post, false) |
||||
|
||||
|
Loading…
Reference in new issue