fix 'load more comments (n)' and 'continue this thread' links #82

This commit is contained in:
teddit 2021-01-04 20:38:12 +01:00
parent e64cbeff71
commit 186d8facb3
1 changed files with 7 additions and 9 deletions

View File

@ -72,9 +72,6 @@ module.exports = function() {
if(!morechildren_ids) { if(!morechildren_ids) {
let load_comms_href = parent_id let load_comms_href = parent_id
if(viewing_comment)
load_comms_href = '../' + parent_id
comments_html = ` comments_html = `
<div class="load-more-comments"> <div class="load-more-comments">
<a href="${load_comms_href}#c">load more comments (${comments.count})</a> <a href="${load_comms_href}#c">load more comments (${comments.count})</a>
@ -92,8 +89,11 @@ module.exports = function() {
} }
} }
} else { } else {
let link = comments.parent_id.split('_')[1]
comments_html = ` comments_html = `
<a href="${comments.id}/">continue this thread</a> <div class="load-more-comments">
<a href="${link}/#c">continue this thread</a>
</div>
` `
} }
} }
@ -165,9 +165,6 @@ module.exports = function() {
if(comment.children.length > 0) { if(comment.children.length > 0) {
let parent_id = comment.parent_id.split('_')[1] let parent_id = comment.parent_id.split('_')[1]
let load_comms_href = parent_id let load_comms_href = parent_id
if(viewing_comment)
load_comms_href = '../' + parent_id
comments_html += ` comments_html += `
<div class="load-more-comments"> <div class="load-more-comments">
@ -175,9 +172,10 @@ module.exports = function() {
</div> </div>
` `
} else { } else {
comments_html += ` let link = comment.parent_id.split('_')[1]
comments_html = `
<div class="load-more-comments"> <div class="load-more-comments">
<a href="${comment.id}">continue this thread</a> <a href="${link}/#c">continue this thread</a>
</div> </div>
` `
} }