diff --git a/db/posts.js b/db/posts.js index fae2c136..20a0a897 100644 --- a/db/posts.js +++ b/db/posts.js @@ -59,6 +59,10 @@ module.exports = { //if enough replies, show omitted count if (thread.replyposts > 5) { + //dont show ALL backlinks on OP for previews on index page + const firstPreviewId = thread.replies[0].postId; + const firstPreviewBacklinkIndex = thread.backlinks.map(bl => bl.postId).indexOf(firstPreviewId); + thread.previewbacklinks = thread.backlinks.slice(firstPreviewBacklinkIndex); //cout omitted image and posts const numPreviewImages = replies.reduce((acc, post) => { return acc + post.files.length }, 0); thread.omittedimages = thread.replyfiles - numPreviewImages; diff --git a/views/mixins/post.pug b/views/mixins/post.pug index 9a8cce9c..9e436696 100644 --- a/views/mixins/post.pug +++ b/views/mixins/post.pug @@ -92,7 +92,14 @@ mixin post(post, truncate, manage=false, globalmanage=false) blockquote.banmessage USER BANNED FOR THIS POST (#{post.banmessage || 'No reason specified'}) if post.omittedposts || post.omittedimages blockquote.muted #{post.omittedposts} post(s)#{post.omittedimages > 0 ? ' and '+post.omittedimages+' image(s)' : ''} omitted. #[a(href=`${postURL}#${post.postId}`) View the full thread] - if post.backlinks && post.backlinks.length > 0 + if post.previewbacklinks + .replies Replies: + each backlink in post.previewbacklinks + a.quote(href=`/${post.board}/thread/${post.thread || post.postId}.html#${backlink.postId}`) >>#{backlink.postId} + | + if post.previewbacklinks.length < post.backlinks.length + | + #{post.backlinks.length-post.previewbacklinks.length} reply link(s) omitted + else if post.backlinks && post.backlinks.length > 0 .replies Replies: each backlink in post.backlinks a.quote(href=`/${post.board}/thread/${post.thread || post.postId}.html#${backlink.postId}`) >>#{backlink.postId}