main
Bob Mottram 2021-07-21 13:05:30 +01:00
parent 70d3e1db67
commit 200dcbd899
1 changed files with 71 additions and 73 deletions

View File

@ -832,7 +832,7 @@ def _getPostTitleAnnounceHtml(baseDir: str,
postJsonObject,
announceDisplayName)
# show avatar of person replied to
announceActor = objJson['attributedTo']
announceActor = attributedTo
announceAvatarUrl = \
getPersonAvatarUrl(baseDir, announceActor,
personCache, allowDownloads)
@ -968,21 +968,53 @@ def _getPostTitleReplyHtml(baseDir: str,
containerClassIcons, containerClass)
# has a reply
if '/statuses/' in objJson['inReplyTo']:
if '/statuses/' not in objJson['inReplyTo']:
postDomain = objJson['inReplyTo']
prefixes = getProtocolPrefixes()
for prefix in prefixes:
postDomain = postDomain.replace(prefix, '')
if '/' in postDomain:
postDomain = postDomain.split('/', 1)[0]
if postDomain:
titleStr += \
_replyWithUnknownPathHtml(translate,
postJsonObject, postDomain)
return (titleStr, replyAvatarImageInPost,
containerClassIcons, containerClass)
inReplyTo = objJson['inReplyTo']
replyActor = inReplyTo.split('/statuses/')[0]
replyNickname = getNicknameFromActor(replyActor)
if replyNickname:
if not replyNickname:
titleStr += \
_replyToUnknownHtml(translate, postJsonObject)
return (titleStr, replyAvatarImageInPost,
containerClassIcons, containerClass)
replyDomain, replyPort = \
getDomainFromActor(replyActor)
if replyNickname and replyDomain:
if not (replyNickname and replyDomain):
titleStr += \
_replyToUnknownHtml(translate, postJsonObject)
return (titleStr, replyAvatarImageInPost,
containerClassIcons, containerClass)
getPersonFromCache(baseDir, replyActor,
personCache,
allowDownloads)
replyDisplayName = \
getDisplayName(baseDir, replyActor,
personCache)
if replyDisplayName:
if not replyDisplayName:
inReplyTo = objJson['inReplyTo']
titleStr += \
_getReplyWithoutDisplayName(translate,
inReplyTo,
replyNickname,
replyDomain)
return (titleStr, replyAvatarImageInPost,
containerClassIcons, containerClass)
# add emoji to the display name
if ':' in replyDisplayName:
_logPostTiming(enableTimingLog, postStartTime, '13.5')
@ -1007,49 +1039,15 @@ def _getPostTitleReplyHtml(baseDir: str,
if replyAvatarUrl:
replyAvatarImageInPost = \
' <div class=' + \
'"timeline-avatar-reply">\n'
replyAvatarImageInPost += \
' ' + \
'<a class="imageAnchor" ' + \
'href="/users/' + nickname + \
'?options=' + replyActor + \
';' + str(pageNumber) + ';' + \
replyAvatarUrl + \
messageIdStr + '">\n'
replyAvatarImageInPost += \
' ' + \
'<img loading="lazy" src="' + \
replyAvatarUrl + '" '
replyAvatarImageInPost += \
'title="' + \
translate['Show profile']
replyAvatarImageInPost += \
'" alt=" "' + \
avatarPosition + \
getBrokenLinkSubstitute() + \
' <div class="timeline-avatar-reply">\n' + \
' <a class="imageAnchor" ' + \
'href="/users/' + nickname + '?options=' + replyActor + \
';' + str(pageNumber) + ';' + replyAvatarUrl + \
messageIdStr + '">\n' + \
' <img loading="lazy" src="' + replyAvatarUrl + '" ' + \
'title="' + translate['Show profile'] + \
'" alt=" "' + avatarPosition + getBrokenLinkSubstitute() + \
'/></a>\n </div>\n'
else:
inReplyTo = objJson['inReplyTo']
titleStr += \
_getReplyWithoutDisplayName(translate,
inReplyTo,
replyNickname,
replyDomain)
else:
titleStr += \
_replyToUnknownHtml(translate, postJsonObject)
else:
postDomain = objJson['inReplyTo']
prefixes = getProtocolPrefixes()
for prefix in prefixes:
postDomain = postDomain.replace(prefix, '')
if '/' in postDomain:
postDomain = postDomain.split('/', 1)[0]
if postDomain:
titleStr += \
_replyWithUnknownPathHtml(translate,
postJsonObject, postDomain)
return (titleStr, replyAvatarImageInPost,
containerClassIcons, containerClass)