feat: do not show the replies container in a post's footer if the only reply present is the next post

This commit is contained in:
Julian Lam
2023-06-14 16:40:52 -04:00
parent 0f84f597df
commit da02361b13
3 changed files with 28 additions and 4 deletions

View File

@@ -27,8 +27,10 @@ module.exports = function (utils, Benchpress, relative_path) {
increment,
generateRepliedTo,
generateWrote,
register,
isoTimeToLocaleString,
shouldHideReplyContainer,
register,
__escape: identity,
};
@@ -342,6 +344,14 @@ module.exports = function (utils, Benchpress, relative_path) {
return new Date(isoTime).toLocaleString().replace(/,/g, ',');
}
function shouldHideReplyContainer(post) {
if (post.replies.count <= 0 || post.replies.hasSingleImmediateReply) {
return true;
}
return false;
}
function register() {
Object.keys(helpers).forEach(function (helperName) {
Benchpress.registerHelper(helperName, helpers[helperName]);