mirror of https://gitlab.com/bashrc2/epicyon
Tidying
parent
70d3e1db67
commit
200dcbd899
144
webapp_post.py
144
webapp_post.py
|
@ -832,7 +832,7 @@ def _getPostTitleAnnounceHtml(baseDir: str,
|
||||||
postJsonObject,
|
postJsonObject,
|
||||||
announceDisplayName)
|
announceDisplayName)
|
||||||
# show avatar of person replied to
|
# show avatar of person replied to
|
||||||
announceActor = objJson['attributedTo']
|
announceActor = attributedTo
|
||||||
announceAvatarUrl = \
|
announceAvatarUrl = \
|
||||||
getPersonAvatarUrl(baseDir, announceActor,
|
getPersonAvatarUrl(baseDir, announceActor,
|
||||||
personCache, allowDownloads)
|
personCache, allowDownloads)
|
||||||
|
@ -968,78 +968,7 @@ def _getPostTitleReplyHtml(baseDir: str,
|
||||||
containerClassIcons, containerClass)
|
containerClassIcons, containerClass)
|
||||||
|
|
||||||
# has a reply
|
# has a reply
|
||||||
if '/statuses/' in objJson['inReplyTo']:
|
if '/statuses/' not in objJson['inReplyTo']:
|
||||||
inReplyTo = objJson['inReplyTo']
|
|
||||||
replyActor = inReplyTo.split('/statuses/')[0]
|
|
||||||
replyNickname = getNicknameFromActor(replyActor)
|
|
||||||
if replyNickname:
|
|
||||||
replyDomain, replyPort = \
|
|
||||||
getDomainFromActor(replyActor)
|
|
||||||
if replyNickname and replyDomain:
|
|
||||||
getPersonFromCache(baseDir, replyActor,
|
|
||||||
personCache,
|
|
||||||
allowDownloads)
|
|
||||||
replyDisplayName = \
|
|
||||||
getDisplayName(baseDir, replyActor,
|
|
||||||
personCache)
|
|
||||||
if replyDisplayName:
|
|
||||||
# add emoji to the display name
|
|
||||||
if ':' in replyDisplayName:
|
|
||||||
_logPostTiming(enableTimingLog, postStartTime, '13.5')
|
|
||||||
|
|
||||||
replyDisplayName = \
|
|
||||||
addEmojiToDisplayName(baseDir, httpPrefix,
|
|
||||||
nickname, domain,
|
|
||||||
replyDisplayName, False)
|
|
||||||
_logPostTiming(enableTimingLog, postStartTime, '13.6')
|
|
||||||
|
|
||||||
titleStr += \
|
|
||||||
_getReplyHtml(translate, inReplyTo, replyDisplayName)
|
|
||||||
|
|
||||||
_logPostTiming(enableTimingLog, postStartTime, '13.7')
|
|
||||||
|
|
||||||
# show avatar of person replied to
|
|
||||||
replyAvatarUrl = \
|
|
||||||
getPersonAvatarUrl(baseDir, replyActor,
|
|
||||||
personCache, allowDownloads)
|
|
||||||
|
|
||||||
_logPostTiming(enableTimingLog, postStartTime, '13.8')
|
|
||||||
|
|
||||||
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() + \
|
|
||||||
'/></a>\n </div>\n'
|
|
||||||
else:
|
|
||||||
inReplyTo = objJson['inReplyTo']
|
|
||||||
titleStr += \
|
|
||||||
_getReplyWithoutDisplayName(translate,
|
|
||||||
inReplyTo,
|
|
||||||
replyNickname,
|
|
||||||
replyDomain)
|
|
||||||
else:
|
|
||||||
titleStr += \
|
|
||||||
_replyToUnknownHtml(translate, postJsonObject)
|
|
||||||
else:
|
|
||||||
postDomain = objJson['inReplyTo']
|
postDomain = objJson['inReplyTo']
|
||||||
prefixes = getProtocolPrefixes()
|
prefixes = getProtocolPrefixes()
|
||||||
for prefix in prefixes:
|
for prefix in prefixes:
|
||||||
|
@ -1050,6 +979,75 @@ def _getPostTitleReplyHtml(baseDir: str,
|
||||||
titleStr += \
|
titleStr += \
|
||||||
_replyWithUnknownPathHtml(translate,
|
_replyWithUnknownPathHtml(translate,
|
||||||
postJsonObject, postDomain)
|
postJsonObject, postDomain)
|
||||||
|
return (titleStr, replyAvatarImageInPost,
|
||||||
|
containerClassIcons, containerClass)
|
||||||
|
|
||||||
|
inReplyTo = objJson['inReplyTo']
|
||||||
|
replyActor = inReplyTo.split('/statuses/')[0]
|
||||||
|
replyNickname = getNicknameFromActor(replyActor)
|
||||||
|
if not replyNickname:
|
||||||
|
titleStr += \
|
||||||
|
_replyToUnknownHtml(translate, postJsonObject)
|
||||||
|
return (titleStr, replyAvatarImageInPost,
|
||||||
|
containerClassIcons, containerClass)
|
||||||
|
|
||||||
|
replyDomain, replyPort = \
|
||||||
|
getDomainFromActor(replyActor)
|
||||||
|
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 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')
|
||||||
|
|
||||||
|
replyDisplayName = \
|
||||||
|
addEmojiToDisplayName(baseDir, httpPrefix,
|
||||||
|
nickname, domain,
|
||||||
|
replyDisplayName, False)
|
||||||
|
_logPostTiming(enableTimingLog, postStartTime, '13.6')
|
||||||
|
|
||||||
|
titleStr += \
|
||||||
|
_getReplyHtml(translate, inReplyTo, replyDisplayName)
|
||||||
|
|
||||||
|
_logPostTiming(enableTimingLog, postStartTime, '13.7')
|
||||||
|
|
||||||
|
# show avatar of person replied to
|
||||||
|
replyAvatarUrl = \
|
||||||
|
getPersonAvatarUrl(baseDir, replyActor,
|
||||||
|
personCache, allowDownloads)
|
||||||
|
|
||||||
|
_logPostTiming(enableTimingLog, postStartTime, '13.8')
|
||||||
|
|
||||||
|
if replyAvatarUrl:
|
||||||
|
replyAvatarImageInPost = \
|
||||||
|
' <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'
|
||||||
|
|
||||||
return (titleStr, replyAvatarImageInPost,
|
return (titleStr, replyAvatarImageInPost,
|
||||||
containerClassIcons, containerClass)
|
containerClassIcons, containerClass)
|
||||||
|
|
Loading…
Reference in New Issue