From b51056002e9fbd555538d8d349de2d1f6d0d3701 Mon Sep 17 00:00:00 2001 From: fatchan Date: Sat, 4 May 2019 05:02:59 +0000 Subject: [PATCH] allow cross board quotes to _just_ the board without a post id --- gulp/res/css/style.css | 5 ----- helpers/quotes.js | 6 ++++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/gulp/res/css/style.css b/gulp/res/css/style.css index 4b00f618..f65cd5e2 100644 --- a/gulp/res/css/style.css +++ b/gulp/res/css/style.css @@ -163,13 +163,8 @@ blockquote a, a:hover { color: #d00!important; } -.op blockquote { - margin: 1em; -} - blockquote { white-space: pre-wrap; - margin: 1em; } .thread, .action-wrapper, .form-wrapper, .table-container { diff --git a/helpers/quotes.js b/helpers/quotes.js index 830884a9..54e3c37d 100644 --- a/helpers/quotes.js +++ b/helpers/quotes.js @@ -3,7 +3,7 @@ const Posts = require(__dirname+'/../db/posts.js') , Boards = require(__dirname+'/../db/posts.js') , quoteRegex = />>\d+/g - , crossQuoteRegex = />>>\/\w+\/\d+/g; + , crossQuoteRegex = />>>\/\w+\/\d*$/gm; module.exports = async (board, text) => { @@ -31,7 +31,7 @@ module.exports = async (board, text) => { const crossQuote = crossQuotes[i].split('/'); const crossQuoteBoard = crossQuote[1]; const crossQuotePostId = +crossQuote[2]; - if (crossQuoteBoard === board) { + if (crossQuoteBoard === board || crossQuotePostId === 0) { //zero for no postid, i.e. just a board quote continue; } if (!crossQuoteMap[crossQuoteBoard]) { @@ -86,6 +86,8 @@ module.exports = async (board, text) => { const quotenum = +quote[2]; if (postThreadIdMap[quoteboard] && postThreadIdMap[quoteboard][quotenum]) { return `>>>/${quoteboard}/${quotenum}`; + } else if (postThreadIdMap[quoteboard] && quotenum === 0) { + return `>>>/${quoteboard}/`; } return match; });