From 42a3661d9e9540568991656d9fd6ac2dfb1a74c1 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 1 Dec 2020 14:08:12 +0000 Subject: [PATCH] Function to get post footer with icons --- webapp_post.py | 50 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/webapp_post.py b/webapp_post.py index 633d00dc..965befd4 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -1070,6 +1070,33 @@ def getPostTitleHtml(baseDir: str, containerClass) +def getFooterWithIcons(showIcons: bool, + containerClassIcons: str, + replyStr: str, announceStr: str, + likeStr: str, bookmarkStr: str, + deleteStr: str, muteStr: str, editStr: str, + postJsonObject: {}, publishedLink: str, + timeClass: str, publishedStr: str) -> str: + """Returns the html for a post footer containing icons + """ + if not showIcons: + return None + + footerStr = '\n
\n' + footerStr += replyStr + announceStr + likeStr + bookmarkStr + \ + deleteStr + muteStr + editStr + if not isNewsPost(postJsonObject): + footerStr += ' ' + publishedStr + '\n' + else: + footerStr += ' ' + publishedStr + '\n' + footerStr += '
\n' + return footerStr + + def individualPostAsHtml(allowDownloads: bool, recentPostsCache: {}, maxRecentPosts: int, iconsPath: str, translate: {}, @@ -1447,20 +1474,15 @@ def individualPostAsHtml(allowDownloads: bool, containerClassIcons = 'containericons dm' containerClass = 'container dm' - # add icons to the bottom of the post - if showIcons: - footerStr = '\n
\n' - footerStr += replyStr + announceStr + likeStr + bookmarkStr + \ - deleteStr + muteStr + editStr - if not isNewsPost(postJsonObject): - footerStr += ' ' + publishedStr + '\n' - else: - footerStr += ' ' + publishedStr + '\n' - footerStr += '
\n' + newFooterStr = getFooterWithIcons(showIcons, + containerClassIcons, + replyStr, announceStr, + likeStr, bookmarkStr, + deleteStr, muteStr, editStr, + postJsonObject, publishedLink, + timeClass, publishedStr) + if newFooterStr: + footerStr = newFooterStr postIsSensitive = False if postJsonObject['object'].get('sensitive'):