diff --git a/webapp_post.py b/webapp_post.py index 4b9eb926e..bc36ad7b6 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -352,6 +352,45 @@ def getEditIconHtml(baseDir: str, nickname: str, domainFull: str, return editStr +def getAnnounceIconHtml(nickname: str, domainFull: str, + postJsonObject: {}, + isPublicRepeat: bool, + isModerationPost: bool, + showRepeatIcon: bool, + translate: {}, + pageNumberParam: str, + timelinePostBookmark: str, + boxName: str, iconsPath: str) -> str: + """Returns html for announce icon/button + """ + announceStr = '' + if not isModerationPost and showRepeatIcon: + # don't allow announce/repeat of your own posts + announceIcon = 'repeat_inactive.png' + announceLink = 'repeat' + if not isPublicRepeat: + announceLink = 'repeatprivate' + announceTitle = translate['Repeat this post'] + if announcedByPerson(postJsonObject, nickname, domainFull): + announceIcon = 'repeat.png' + if not isPublicRepeat: + announceLink = 'unrepeatprivate' + announceTitle = translate['Undo the repeat'] + announceStr = \ + ' \n' + announceStr += \ + ' ' + \ + '' + translate['Repeat this post'] + \
+            ' |\n' + return announceStr + + def individualPostAsHtml(allowDownloads: bool, recentPostsCache: {}, maxRecentPosts: int, iconsPath: str, translate: {}, @@ -624,31 +663,15 @@ def individualPostAsHtml(allowDownloads: bool, postJsonObject, actorNickname, translate, iconsPath, isEvent) - announceStr = '' - if not isModerationPost and showRepeatIcon: - # don't allow announce/repeat of your own posts - announceIcon = 'repeat_inactive.png' - announceLink = 'repeat' - if not isPublicRepeat: - announceLink = 'repeatprivate' - announceTitle = translate['Repeat this post'] - if announcedByPerson(postJsonObject, nickname, domainFull): - announceIcon = 'repeat.png' - if not isPublicRepeat: - announceLink = 'unrepeatprivate' - announceTitle = translate['Undo the repeat'] - announceStr = \ - ' \n' - announceStr += \ - ' ' + \ - '' + translate['Repeat this post'] + \
-            ' |\n' + announceStr = getAnnounceIconHtml(nickname, + postJsonObject, + isPublicRepeat, + isModerationPost, + showRepeatIcon, + translate, + pageNumberParam, + timelinePostBookmark, + boxName, iconsPath) # benchmark 12 if enableTimingLog: