From f0f811bd25fc3b9005598da10971bd1e7d9a0e7a Mon Sep 17 00:00:00 2001 From: fatchan Date: Sat, 13 Jul 2019 23:47:44 +0000 Subject: [PATCH] quote improvement for when board doesnt exist, dont search for a post --- helpers/posting/quotes.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/helpers/posting/quotes.js b/helpers/posting/quotes.js index 3133bb8d..93dcaf74 100644 --- a/helpers/posting/quotes.js +++ b/helpers/posting/quotes.js @@ -39,13 +39,14 @@ module.exports = async (board, text, thread) => { if (!crossQuoteMap[crossQuoteBoard]) { crossQuoteMap[crossQuoteBoard] = []; } - if (!isNaN(crossQuotePostId)) { + if (!isNaN(crossQuotePostId) && crossQuotePostId > 0) { crossQuoteMap[crossQuoteBoard].push(crossQuotePostId); } } const crossQuoteBoards = Object.keys(crossQuoteMap) for (let i = 0; i < crossQuoteBoards.length; i++) { const crossQuoteBoard = crossQuoteBoards[i]; + boardQueryIns.push(crossQuoteBoard); const crossQuoteBoardPostIds = crossQuoteMap[crossQuoteBoard]; if (crossQuoteBoardPostIds.length > 0) { postQueryOrs.push({ @@ -54,8 +55,6 @@ module.exports = async (board, text, thread) => { '$in': crossQuoteBoardPostIds } }); - } else { - boardQueryIns.push(crossQuoteBoard); } } } @@ -109,7 +108,7 @@ module.exports = async (board, text, thread) => { const quoteboard = quote[1]; const quotenum = +quote[2]; if (postThreadIdMap[quoteboard]) { - if (!isNaN(quotenum) && postThreadIdMap[quoteboard][quotenum]) { + if (!isNaN(quotenum) && quoteNnum > 0 && postThreadIdMap[quoteboard][quotenum]) { return `>>>/${quoteboard}/${quotenum}`; } else { return `>>>/${quoteboard}/`;