From 51ab684fe247f86684768b4ff642eaa50f5e979b Mon Sep 17 00:00:00 2001 From: Bob Mottram <bob@freedombone.net> Date: Tue, 25 Feb 2020 21:52:22 +0000 Subject: [PATCH] Only show replies section if there are some --- blog.py | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/blog.py b/blog.py index 6720f47d..55a53b1a 100644 --- a/blog.py +++ b/blog.py @@ -160,30 +160,29 @@ def htmlBlogPostContent(authorized: bool, \ '<p class="about"><a class="about" href="'+httpPrefix+'://'+domainFull+ \ '/users/'+nickname+'">'+translate['About the author']+'</a></p>\n' - if not authorized: - replies= \ - noOfBlogReplies(baseDir,httpPrefix,translate, \ - nickname,domain,domainFull, \ - postJsonObject) - if replies>0: + replies= \ + noOfBlogReplies(baseDir,httpPrefix,translate, \ + nickname,domain,domainFull, \ + postJsonObject) + if replies>0: + if not authorized: blogStr+= \ '<p class="blogreplies">'+ \ translate['Replies'].lower()+': '+str(replies)+'</p>\n' - else: - blogStr+='<h1>'+translate['Replies']+'</h1>\n' - blogStr+='<script>'+contentWarningScriptOpen()+'</script>\n' - if not titleStr: - blogStr+= \ - getBlogReplies(baseDir,httpPrefix,translate, \ - nickname,domain,domainFull, \ - postJsonObject) else: - blogStr+= \ - getBlogReplies(baseDir,httpPrefix,translate, \ - nickname,domain,domainFull, \ - postJsonObject).replace('>'+titleStr+'<','') - blogStr+='<br><hr>\n' - + blogStr+='<h1>'+translate['Replies']+'</h1>\n' + blogStr+='<script>'+contentWarningScriptOpen()+'</script>\n' + if not titleStr: + blogStr+= \ + getBlogReplies(baseDir,httpPrefix,translate, \ + nickname,domain,domainFull, \ + postJsonObject) + else: + blogStr+= \ + getBlogReplies(baseDir,httpPrefix,translate, \ + nickname,domain,domainFull, \ + postJsonObject).replace('>'+titleStr+'<','') + blogStr+='<br><hr>\n' return blogStr