remove broken tag from end of length truncated message previews, and only add truncation message where necessary

merge-requests/208/head
fatchan 5 years ago
parent cfb53d3cc1
commit 50bbbbc7e8
  1. 2
      models/forms/actionhandler.js
  2. 7
      views/mixins/post.pug
  3. 2
      views/pages/manage.pug

@ -254,7 +254,7 @@ module.exports = async (req, res, next) => {
}, {});
//now we need to delete outdated html
//TODO: not do this for reports, handle global actions & move to separate handler + optimize and test
//TODO: not do this for reports
const parallelPromises = []
const boardNames = Object.keys(threadBounds);
const buildBoards = {};

@ -70,16 +70,13 @@ mixin post(post, truncate, manage=false, globalmanage=false)
const splitPost = post.message.split('\n');
const messageLines = splitPost.length;
let truncatedMessage = post.message;
let truncated = false;
if (messageLines > 10) {
truncatedMessage = splitPost.slice(0, 10).join('\n');
truncated = true;
} else if (post.message.length > 1000) {
truncatedMessage = `${post.message.substring(0,1000)}...`;
truncated = true;
truncatedMessage = post.message.substring(0,1000).replace(/<([\w]+)?([^>]*)?$/, '');
}
pre.post-message !{truncatedMessage}
if truncated
if truncatedMessage !== post.message
blockquote Message too long. #[a(href=postURL) View the full text]
else
pre.post-message !{post.message}

@ -16,12 +16,10 @@ block content
.postform-label IDs
label.postform-style.ph-5
input(type='checkbox', name='ids', value='true' checked=board.settings.ids)
| Show per-thread IDs
section.postform-row
.postform-label Force Anon
label.postform-style.ph-5
input(type='checkbox', name='force_anon', value='true' checked=board.settings.forceAnon)
| Disable names and only allow sage email
section.postform-row
.postform-label Post Captcha
label.postform-style.ph-5

Loading…
Cancel
Save