From 6084fbcce9fa3ebf1373e2e48a36e3e21422e86b Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 3 Jun 2020 10:16:53 +0100 Subject: [PATCH] Separate function for content warning button --- webinterface.py | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/webinterface.py b/webinterface.py index cb74c0ef..32d77880 100644 --- a/webinterface.py +++ b/webinterface.py @@ -73,6 +73,16 @@ from git import isGitPatch from theme import getThemesList +def getContentWarningButton(postID: str, translate: {}, + content: str) -> str: + """Returns the markup for a content warning button + """ + return '' + \ + '
' + \ + content + '
' + + def getBlogAddress(actorJson: {}) -> str: """Returns blog address for the given actor """ @@ -4095,17 +4105,15 @@ def individualPostAsHtml(recentPostsCache: {}, maxRecentPosts: int, '' + postJsonObject['object']['summary'] + ' ' if isModerationPost: containerClass = 'container report' - contentStr += \ - '' - contentStr += '
' - contentStr += objectContent + attachmentStr + # get the content warning text + cwContentStr = objectContent + attachmentStr if not isPatch: - contentStr = addEmbeddedElements(translate, contentStr) - contentStr = \ + cwContentStr = addEmbeddedElements(translate, cwContentStr) + cwContentStr = \ insertQuestion(baseDir, translate, nickname, domain, port, - contentStr, postJsonObject, pageNumber) - contentStr += '
' + cwContentStr, postJsonObject, pageNumber) + # get the content warning button + contentStr += getContentWarningButton(postID, translate, cwContentStr) if postJsonObject['object'].get('tag') and not isPatch: contentStr = \