Only show replies section if there are some

main
Bob Mottram 2020-02-25 21:52:22 +00:00
parent 03995be9f4
commit 51ab684fe2
1 changed files with 19 additions and 20 deletions

39
blog.py
View File

@ -160,30 +160,29 @@ def htmlBlogPostContent(authorized: bool, \
'<p class="about"><a class="about" href="'+httpPrefix+'://'+domainFull+ \ '<p class="about"><a class="about" href="'+httpPrefix+'://'+domainFull+ \
'/users/'+nickname+'">'+translate['About the author']+'</a></p>\n' '/users/'+nickname+'">'+translate['About the author']+'</a></p>\n'
if not authorized: replies= \
replies= \ noOfBlogReplies(baseDir,httpPrefix,translate, \
noOfBlogReplies(baseDir,httpPrefix,translate, \ nickname,domain,domainFull, \
nickname,domain,domainFull, \ postJsonObject)
postJsonObject) if replies>0:
if replies>0: if not authorized:
blogStr+= \ blogStr+= \
'<p class="blogreplies">'+ \ '<p class="blogreplies">'+ \
translate['Replies'].lower()+': '+str(replies)+'</p>\n' 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: else:
blogStr+= \ blogStr+='<h1>'+translate['Replies']+'</h1>\n'
getBlogReplies(baseDir,httpPrefix,translate, \ blogStr+='<script>'+contentWarningScriptOpen()+'</script>\n'
nickname,domain,domainFull, \ if not titleStr:
postJsonObject).replace('>'+titleStr+'<','') blogStr+= \
blogStr+='<br><hr>\n' 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 return blogStr