Fix bug in reporter banning, thanks to automated tests

merge-requests/341/head
Thomas Lynch 2 years ago
parent b0acd40c18
commit 24a8f5ae18
  1. 1
      db/posts.js
  2. 6
      models/forms/banposter.js
  3. 2
      test/setup.js

@ -711,6 +711,7 @@ module.exports = {
hotThreads: async () => {
const { hotThreadsLimit, hotThreadsThreshold } = config.get;
console.log(hotThreadsLimit, hotThreadsThreshold)
if (hotThreadsLimit === 0){ //0 limit = no limit in mongodb
return [];
}

@ -26,9 +26,9 @@ module.exports = async (req, res, next) => {
const banType = ip.endsWith('.IP') ? 0 :
ip.endsWith('.BP') ? 1 :
2;
const thisIpPosts = ipPosts[ip];
/* should we at some point filter these to not bother banning pruned ips,
and/or not range banning bypasses (since it does nothing)? */
const thisIpPosts = ipPosts[ip];
let banRange = 0;
let banIp = {
cloak: thisIpPosts[0].ip.cloak,
@ -87,8 +87,8 @@ module.exports = async (req, res, next) => {
}
ips = ips.filter(n => n);
[...new Set(ips)].forEach(ip => {
const banType = ip.endsWith('.IP') ? 0 :
ip.endsWith('.BP') ? 1 :
const banType = ip.cloak.endsWith('.IP') ? 0 :
ip.cloak.endsWith('.BP') ? 1 :
2;
bans.push({
'type': banType,

@ -87,6 +87,8 @@ module.exports = () => describe('login and create test board', () => {
early_404_fraction: '3',
early_404_replies: '5',
max_recent_news: '5',
hot_threads_limit: '5',
hot_threads_threshold: '10',
captcha_options_type: 'text',
captcha_options_grid_image_size: '120',
captcha_options_grid_size: '4',

Loading…
Cancel
Save