modlog bugfix

merge-requests/208/head
fatchan 5 years ago
parent 8484d12e38
commit 90fa066261
  1. 4
      db/modlogs.js
  2. 2
      helpers/build.js
  3. 4
      helpers/datearray.js
  4. 4
      models/forms/create.js
  5. 5
      models/pages/modlog.js

@ -8,13 +8,13 @@ module.exports = {
getFirst: (board) => {
return db.find({
'board': board._id
}).sort({_id:-1}).limit(1).toArray();
}).sort({_id:1}).limit(1).toArray();
},
getLast: (board) => {
return db.find({
'board': board._id
}).sort({_id:1}).limit(1).toArray();
}).sort({_id:-1}).limit(1).toArray();
},
findBetweenDate: (board, start, end) => {

@ -145,7 +145,7 @@ module.exports = {
const firstLogDate = firstLog[0].date;
firstLogDate.setHours(1,0,0,0);
const lastLogDate = lastLog[0].date;
dates = dateArray(firstLogDate, lastLogDate);
dates = dateArray(firstLogDate, lastLogDate).reverse();
}
await render(label, 'modloglist.pug', {
board,

@ -2,8 +2,8 @@
//https://stackoverflow.com/a/4413721
module.exports = (startDate, stopDate) => {
var dateArray = new Array();
var currentDate = startDate;
const dateArray = new Array();
let currentDate = startDate;
while (currentDate <= stopDate) {
dateArray.push(new Date (currentDate.valueOf()));
currentDate.setDate(currentDate.getDate() + 1);

@ -32,8 +32,8 @@ module.exports = async (req, res, next) => {
'moderators': [],
'locked': false,
'captchaMode': 0,
'tphTrigger': 0,
'tphTriggerAction': 0,
'tphTrigger': 10,
'tphTriggerAction': 1,
'forceAnon': false,
'early404': true,
'ids': false,

@ -10,11 +10,10 @@ module.exports = async (req, res, next) => {
return next();
}
const startDate = res.locals.date;
const endDate = new Date(startDate.getTime());
const startDate = new Date(res.locals.date);
const endDate = new Date(startDate.valueOf());
startDate.setHours(0,0,0,0);
endDate.setHours(23,59,59,999);
try {
const logs = await Modlogs.findBetweenDate(res.locals.board, startDate, endDate);
if (!logs || logs.length === 0) {

Loading…
Cancel
Save