Function for reply title with unknown path

merge-requests/30/head
Bob Mottram 2020-12-01 13:24:22 +00:00
parent c6e9d38f53
commit d628dfd9c6
1 changed files with 20 additions and 10 deletions

View File

@ -864,6 +864,24 @@ def replyToUnknownHtml(translate: {}, iconsPath: str,
'" class="announceOrReply">@unknown</a>\n' '" class="announceOrReply">@unknown</a>\n'
def replyWithUnknownPath(translate: {}, iconsPath: str,
postJsonObject: {},
postDomain: str) -> str:
"""Returns html title for a reply with an unknown path
eg. does not contain /statuses/
"""
return ' <img loading="lazy" title="' + \
translate['replying to'] + \
'" alt="' + translate['replying to'] + \
'" src="/' + \
iconsPath + '/reply.png" ' + \
'class="announceOrReply"/>\n' + \
' <a href="' + \
postJsonObject['object']['inReplyTo'] + \
'" class="announceOrReply">' + \
postDomain + '</a>\n'
def getPostTitleReplyHtml(baseDir: str, def getPostTitleReplyHtml(baseDir: str,
httpPrefix: str, httpPrefix: str,
nickname: str, domain: str, nickname: str, domain: str,
@ -1032,16 +1050,8 @@ def getPostTitleReplyHtml(baseDir: str,
postDomain = postDomain.split('/', 1)[0] postDomain = postDomain.split('/', 1)[0]
if postDomain: if postDomain:
titleStr += \ titleStr += \
' <img loading="lazy" title="' + \ replyWithUnknownPath(translate, iconsPath,
translate['replying to'] + \ postJsonObject, postDomain)
'" alt="' + translate['replying to'] + \
'" src="/' + \
iconsPath + '/reply.png" ' + \
'class="announceOrReply"/>\n' + \
' <a href="' + \
postJsonObject['object']['inReplyTo'] + \
'" class="announceOrReply">' + \
postDomain + '</a>\n'
return (titleStr, replyAvatarImageInPost, return (titleStr, replyAvatarImageInPost,
containerClassIcons, containerClass) containerClassIcons, containerClass)