merge-requests/208/head
fatchan 5 years ago
parent cfab8c4ade
commit 887ea41aec
  1. 7
      models/forms/changeboardsettings.js
  2. 4
      models/forms/makepost.js
  3. 4
      schedules.js

@ -89,6 +89,11 @@ module.exports = async (req, res, next) => {
//array of promises we might need
const promises = [];
//pages in new vs old settings
const oldMaxPage = Math.ceil(oldSettings.threadLimit/10);
const newMaxPage = Math.ceil(newSettings.threadLimit/10);
//add stuff to queue or remotve threads if captcha enabled (since need to add captcha to post form)
let captchaEnabled = false;
if (newSettings.captchaMode > oldSettings.captchaMode) {
captchaEnabled = true;
@ -106,8 +111,6 @@ module.exports = async (req, res, next) => {
}
//do rebuilding and pruning if max number of pages is changed and any threads are pruned
const oldMaxPage = Math.ceil(oldSettings.threadLimit/10);
const newMaxPage = Math.ceil(newSettings.threadLimit/10);
if (newMaxPage < oldMaxPage) {
//prune old threads
const prunedThreads = await Posts.pruneThreads(res.locals.board);

@ -405,7 +405,7 @@ module.exports = async (req, res, next) => {
res.redirect(successRedirect);
//now add other pages to be built in background
if (captchaEnabled) {
if (enableCaptcha) {
if (res.locals.board.settings.captchaMode == 2) {
//only delete threads if all posts require threads, otherwise just build board pages for thread captcha
await remove(`${uploadDirectory}html/${req.params.board}/thread/`);
@ -446,7 +446,7 @@ module.exports = async (req, res, next) => {
const prunedThreads = await Posts.pruneThreads(res.locals.board);
if (prunedThreads.length > 0) {
await deletePosts(prunedThreads, req.params.board);
if (!captchaEnabled) {
if (!enableCaptcha) {
buildQueue.push({
'task': 'buildBoardMultiple',
'options': {

@ -18,12 +18,12 @@ const msTime = require(__dirname+'/helpers/mstime.js')
console.log('Starting schedules');
// setInterval(async () => {
setInterval(async () => {
buildQueue.push({
'task': 'buildHomepage',
'options': {}
})
// }, msTime.minute*5); //rebuild homepage for pph updates
}, msTime.minute*5); //rebuild homepage for pph updates
setInterval(async () => {
try {

Loading…
Cancel
Save