add IP delete by board or global (no by-thread)

merge-requests/208/head
fatchan 5 years ago
parent 022b16cbd7
commit 363f4bd1b1
  1. 34
      controllers/forms.js
  2. 5
      gulp/res/css/style.css
  3. 3
      helpers/actionchecker.js
  4. 7
      views/includes/actionfooter.pug
  5. 8
      views/includes/actionfooter_globalmanage.pug
  6. 2
      views/includes/actionfooter_manage.pug
  7. 2
      views/mixins/post.pug

@ -382,8 +382,23 @@ router.post('/board/:board/actions', Boards.exists, banCheck, paramConverter, ve
messages.push(message);
}
}
//TODO: IP-based deletes here. will need to gather all thread/board/global posts by IP, then run them through deletePosts
if (req.body.delete) {
if (hasPerms && (req.body.delete_ip_board || req.body.delete_ip_global)) {
const deletePostIps = posts.map(x => x.ip);
let query = {
'ip': {
'$in': deletePostIps
}
};
if (req.body.delete_ip_board) {
query['board'] = req.params.board;
}
const deleteIpPosts = await Posts.db.find(query).toArray();
if (deleteIpPosts && deleteIpPosts.length > 0) {
const { message } = await deletePosts(req, res, next, deleteIpPosts, req.params.board);
messages.push(message);
aggregateNeeded = true;
}
} else if (req.body.delete) {
const { message } = await deletePosts(req, res, next, passwordPosts, req.params.board);
messages.push(message);
aggregateNeeded = true;
@ -597,8 +612,19 @@ router.post('/global/actions', checkPermsMiddleware, paramConverter, async(req,
}
messages.push(message);
}
//TODO: IP-based deletes here. will need to gather all thread/board/global posts by IP, then run them through deletePosts
if (req.body.delete) {
if (hasPerms && req.body.delete_ip_global) {
const deletePostIps = posts.map(x => x.ip);
const deleteIpPosts = await Posts.db.find({
'ip': {
'$in': deletePostIps
}
}).toArray();
if (deleteIpPosts && deleteIpPosts.length > 0) {
const { message } = await deletePosts(req, res, next, deleteIpPosts, null);
messages.push(message);
aggregateNeeded = true;
}
} else if (req.body.delete) {
const { message } = await deletePosts(req, res, next, posts);
messages.push(message);
aggregateNeeded = true;

@ -45,10 +45,13 @@ body {
margin: 10px 0;
padding: 10px;
}
a, a:visited {
text-decoration: underline;
color: #34345C;
}
.pages a {
text-decoration: none;
color: black;
}
object {

@ -8,8 +8,7 @@ const actions = [
{name:'global_report', global:false, auth:false, passwords:false},
{name:'spoiler', global:true, auth:false, passwords:true},
{name:'delete', global:true, auth:false, passwords:true},
{name:'delete_ip_thread', global:true, auth:true, passwords:false},
{name:'delete_ip_board', global:true, auth:true, passwords:false},
{name:'delete_ip_board', global:false, auth:true, passwords:false},
{name:'delete_ip_global', global:true, auth:true, passwords:false},
{name:'delete_file', global:true, auth:false, passwords:true},
{name:'dismiss', global:false, auth:true, passwords:false},

@ -24,15 +24,12 @@ label.toggle-label Toggle Post Actions
input#report(type='text', name='report_reason', placeholder='report reason' autocomplete='off')
.actions
h4.no-m-p Mod Actions:
label
input.post-check(type='checkbox', name='delete_ip_thread' value=1)
| Delete IP+ thread
label
input.post-check(type='checkbox', name='delete_ip_board' value=1)
| Delete IP+ board
| Delete from IP on board
label
input.post-check(type='checkbox', name='delete_ip_global' value=1)
| Delete IP+ global
| Delete from IP globally
label
input.post-check(type='checkbox', name='sticky' value=1)
| Sticky

@ -16,15 +16,9 @@ label.toggle-label Toggle Post Actions
input#report(type='text', name='report_reason', placeholder='report reason' autocomplete='off')
.actions
h4.no-m-p Mod Actions:
label
input.post-check(type='checkbox', name='delete_ip_thread' value=1)
| Delete IP+ thread
label
input.post-check(type='checkbox', name='delete_ip_board' value=1)
| Delete IP+ board
label
input.post-check(type='checkbox', name='delete_ip_global' value=1)
| Delete IP+ global
| Delete from IP globally
label
input.post-check(type='checkbox', name='global_dismiss' value=1)
| Dismiss Global Reports

@ -23,7 +23,7 @@ label.toggle-label Toggle Post Actions
h4.no-m-p Mod Actions:
label
input.post-check(type='checkbox', name='delete_ip_board' value=1)
| Delete IP+ board
| Delete from IP on board
label
input.post-check(type='checkbox', name='dismiss' value=1)
| Dismiss Reports

@ -34,7 +34,7 @@ mixin post(post, truncate, manage=false, globalmanage=false)
|
span.user-id(style=`background: #${post.userId}`) #{post.userId}
|
span: a(href=postURL) #{post.postId}
span: a(href=postURL) No.#{post.postId}
.post-data
if post.files.length > 0
.post-files

Loading…
Cancel
Save