Function for announcing with a display name

main
Bob Mottram 2020-12-01 12:04:59 +00:00
parent d4a834196b
commit c6e947f22e
1 changed files with 20 additions and 10 deletions

View File

@ -692,6 +692,22 @@ def announceWithoutDisplayNameHtml(translate: {}, iconsPath: str,
announceNickname + '@' + announceDomain + '</a>\n' announceNickname + '@' + announceDomain + '</a>\n'
def announceWithDisplayNameHtml(translate: {},
iconsPath: str,
postJsonObject: {},
announceDisplayName: str) -> str:
"""Returns html for an announce having a display name
"""
return ' <img loading="lazy" title="' + \
translate['announces'] + '" alt="' + \
translate['announces'] + '" src="/' + \
iconsPath + '/repeat_inactive.png" ' + \
'class="announceOrReply"/>\n' + \
' <a href="' + \
postJsonObject['object']['id'] + '" ' + \
'class="announceOrReply">' + announceDisplayName + '</a>\n'
def getPostTitleAnnounceHtml(baseDir: str, def getPostTitleAnnounceHtml(baseDir: str,
httpPrefix: str, httpPrefix: str,
nickname: str, domain: str, nickname: str, domain: str,
@ -767,16 +783,10 @@ def getPostTitleAnnounceHtml(baseDir: str,
' 13.3.1 = ' + str(timeDiff)) ' 13.3.1 = ' + str(timeDiff))
titleStr += \ titleStr += \
' ' + \ announceWithDisplayNameHtml(translate,
'<img loading="lazy" title="' + \ iconsPath,
translate['announces'] + '" alt="' + \ postJsonObject,
translate['announces'] + '" src="/' + \ announceDisplayName)
iconsPath + '/repeat_inactive.png" ' + \
'class="announceOrReply"/>\n' + \
' <a href="' + \
postJsonObject['object']['id'] + '" ' + \
'class="announceOrReply">' + \
announceDisplayName + '</a>\n'
# show avatar of person replied to # show avatar of person replied to
announceActor = \ announceActor = \
postJsonObject['object']['attributedTo'] postJsonObject['object']['attributedTo']