From d4a834196ba7e79068db9723b3fd52dd2daf30ab Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 1 Dec 2020 11:43:13 +0000 Subject: [PATCH] Function to show announce title without display name --- webapp_post.py | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/webapp_post.py b/webapp_post.py index 2fff0ce6..329d11f3 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -661,7 +661,8 @@ def boostOwnTootHtml(translate: {}, iconsPath) -> str: '/repeat_inactive.png" class="announceOrReply"/>\n' -def announceUnattributedHtml(translate: {}, iconsPath: str) -> str: +def announceUnattributedHtml(translate: {}, iconsPath: str, + postJsonObject: {}) -> str: """Returns the html for an announce title where there is no attribution on the announced post """ @@ -675,6 +676,22 @@ def announceUnattributedHtml(translate: {}, iconsPath: str) -> str: '" class="announceOrReply">@unattributed\n' +def announceWithoutDisplayNameHtml(translate: {}, iconsPath: str, + announceNickname: str, + announceDomain: str, + postJsonObject: {}) -> str: + """Returns html for an announce title where there is no display name + only a handle nick@domain + """ + return ' ' + translate['announces'] + \
+        '\n' + \ + ' @' + \ + announceNickname + '@' + announceDomain + '\n' + + def getPostTitleAnnounceHtml(baseDir: str, httpPrefix: str, nickname: str, domain: str, @@ -734,6 +751,7 @@ def getPostTitleAnnounceHtml(baseDir: str, print('TIMING INDIV ' + boxName + ' 13.3 = ' + str(timeDiff)) + # add any emoji to the display name if ':' in announceDisplayName: announceDisplayName = \ addEmojiToDisplayName(baseDir, httpPrefix, @@ -796,23 +814,17 @@ def getPostTitleAnnounceHtml(baseDir: str, '/>\n \n' else: titleStr += \ - ' ' + translate['announces'] + \
-                        '\n' + \ - ' @' + \ - announceNickname + '@' + \ - announceDomain + '\n' + announceWithoutDisplayNameHtml(translate, iconsPath, + announceNickname, + announceDomain, + postJsonObject) else: titleStr += \ - announceUnattributedHtml(translate, iconsPath) + announceUnattributedHtml(translate, iconsPath, + postJsonObject) else: titleStr += \ - announceUnattributedHtml(translate, iconsPath) + announceUnattributedHtml(translate, iconsPath, postJsonObject) return (titleStr, replyAvatarImageInPost, containerClassIcons, containerClass)