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'; |
'use strict'; |
||||||
|
|
||||||
const uuidv4 = require('uuid/v4') |
const Posts = require(__dirname+'/../../db-models/posts.js'); |
||||||
, path = require('path') |
|
||||||
, 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
|
throw new Error('Not implemented'); |
||||||
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 ``; |
|
||||||
|
|
||||||
} |
} |
||||||
|
@ -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 |
include ./post.pug |
||||||
|
|
||||||
mixin ban(ban) |
mixin ban(ban) |
||||||
if ban.board |
.ban |
||||||
div Board: #[a(href=`/${ban.board}`) /#{ban.board}/] |
input.post-check(type='checkbox', name='checkedbans[]' value=ban._id) |
||||||
else |
if ban.board |
||||||
div Global ban. |
div Board: #[a(href=`/${ban.board}`) /#{ban.board}/] |
||||||
div Reason: #{ban.reason} |
else |
||||||
div Issuer: #{ban.issuer} |
div Global ban. |
||||||
div Date: #{ban.date} |
div Reason: #{ban.reason} |
||||||
div Expiry: #{ban.expireAt} |
div Issuer: #{ban.issuer} |
||||||
if ban.post |
div Date: #{ban.date} |
||||||
span Post: |
div Expiry: #{ban.expireAt} |
||||||
section.thread |
if ban.post |
||||||
+post(ban.post, false) |
span Post: |
||||||
|
section.thread |
||||||
|
+post(ban.post, false) |
||||||
|
|
||||||
|
Loading…
Reference in new issue