mirror of https://gitgud.io/fatchan/jschan.git
parent
e80e9e4452
commit
d5870187bc
26 changed files with 402 additions and 89 deletions
@ -0,0 +1,25 @@ |
||||
'use strict'; |
||||
|
||||
const Mongo = require(__dirname+'/../../db/db.js') |
||||
, Posts = require(__dirname+'/../../db/posts.js') |
||||
, hasPerms = require(__dirname+'/../../helpers/hasperms.js'); |
||||
|
||||
module.exports = async (req, res, next, posts) => { |
||||
|
||||
if (!hasPerms(req, res)) { |
||||
throw { |
||||
'status': 403, |
||||
'message': { |
||||
'title': 'Forbidden', |
||||
'message': 'You are not authorised to dismiss global reports.', |
||||
'redirect': '/' |
||||
} |
||||
}; |
||||
} |
||||
|
||||
const postMongoIds = posts.map(post => Mongo.ObjectId(post._id)) |
||||
const dismissedCount = await Posts.dismissGlobalReports(postMongoIds).then(result => result.modifiedCount); |
||||
|
||||
return `Dismissed ${dismissedCount} reports successfully`; |
||||
|
||||
} |
@ -0,0 +1,23 @@ |
||||
'use strict'; |
||||
|
||||
const Mongo = require(__dirname+'/../../db/db.js') |
||||
, Posts = require(__dirname+'/../../db/posts.js'); |
||||
|
||||
module.exports = async (req, res, next, posts) => { |
||||
|
||||
const ip = req.headers['x-real-ip'] || req.connection.remoteAddress; |
||||
const report = { |
||||
'reason': req.body.report_reason, |
||||
'date': new Date(), |
||||
'ip': ip |
||||
} |
||||
|
||||
const ids = posts.map(p => Mongo.ObjectId(p._id)) |
||||
|
||||
//push the report to all checked posts
|
||||
const reportedPosts = await Posts.globalReportMany(ids, report).then(result => result.modifiedCount); |
||||
|
||||
//hooray!
|
||||
return `Global reported ${reportedPosts} posts successfully` |
||||
|
||||
} |
@ -0,0 +1,31 @@ |
||||
.action-wrapper |
||||
.actions Actions: |
||||
label |
||||
input.post-check(type='checkbox', name='delete' value=1) |
||||
| Delete |
||||
label |
||||
input.post-check(type='checkbox', name='spoiler' value=1) |
||||
| Spoiler Images |
||||
label |
||||
input#password(type='text', name='password', placeholder='post password' autocomplete='off') |
||||
label |
||||
input.post-check(type='checkbox', name='report' value=1) |
||||
| Report |
||||
label |
||||
input.post-check(type='checkbox', name='global_report' value=1) |
||||
| Global Report |
||||
label |
||||
input#report(type='text', name='report_reason', placeholder='report reason' autocomplete='off') |
||||
.actions Mod Actions: |
||||
label |
||||
input.post-check(type='checkbox', name='ban' value=1) |
||||
| Ban Poster |
||||
label |
||||
input.post-check(type='checkbox', name='global_ban' value=1) |
||||
| Global Ban Poster |
||||
label |
||||
input.post-check(type='checkbox', name='preserve_post' value=1) |
||||
| Show Post In Ban |
||||
label |
||||
input#report(type='text', name='ban_reason', placeholder='ban reason' autocomplete='off') |
||||
input(type='submit', value='submit') |
@ -0,0 +1,24 @@ |
||||
.action-wrapper |
||||
.actions Actions: |
||||
label |
||||
input.post-check(type='checkbox', name='delete' value=1) |
||||
| Delete |
||||
label |
||||
input.post-check(type='checkbox', name='spoiler' value=1) |
||||
| Spoiler Images |
||||
label |
||||
input#report(type='text', name='report_reason', placeholder='report reason' autocomplete='off') |
||||
.actions Mod Actions: |
||||
label |
||||
input.post-check(type='checkbox', name='global_dismiss' value=1) |
||||
| Dismiss Global Reports |
||||
label |
||||
input.post-check(type='checkbox', name='global_ban' value=1) |
||||
| Global Ban Poster |
||||
label |
||||
input.post-check(type='checkbox', name='preserve_post' value=1) |
||||
| Show Post In Ban |
||||
label |
||||
input#report(type='text', name='ban_reason', placeholder='ban reason' autocomplete='off') |
||||
input(type='submit', value='submit') |
||||
|
Loading…
Reference in new issue