mirror of https://gitlab.com/bashrc2/epicyon
Function for unattributed announces
parent
a84e060f5e
commit
2c3d3d2c11
117
webapp_post.py
117
webapp_post.py
|
@ -651,7 +651,31 @@ def getBlogCitationsHtml(boxName: str,
|
|||
return citationsStr
|
||||
|
||||
|
||||
def getPostTitleHtml(baseDir: str,
|
||||
def boostOwnTootHtml(translate: {}, iconsPath) -> str:
|
||||
"""The html title for announcing your own post
|
||||
"""
|
||||
return ' <img loading="lazy" title="' + \
|
||||
translate['announces'] + \
|
||||
'" alt="' + translate['announces'] + \
|
||||
'" src="/' + iconsPath + \
|
||||
'/repeat_inactive.png" class="announceOrReply"/>\n'
|
||||
|
||||
|
||||
def announceUnattributedHtml(translate: {}, iconsPath: str) -> str:
|
||||
"""Returns the html for an announce title where there
|
||||
is no attribution on the announced post
|
||||
"""
|
||||
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">@unattributed</a>\n'
|
||||
|
||||
|
||||
def getPostTitleAnnounceHtml(baseDir: str,
|
||||
httpPrefix: str,
|
||||
nickname: str, domain: str,
|
||||
showRepeatIcon: bool,
|
||||
|
@ -669,29 +693,22 @@ def getPostTitleHtml(baseDir: str,
|
|||
pageNumber: int,
|
||||
messageIdStr: str,
|
||||
containerClassIcons: str,
|
||||
containerClass: str) -> (str, str):
|
||||
"""Returns the title of a post containing names of participants
|
||||
x replies to y, x announces y, etc
|
||||
containerClass: str) -> (str, str, str, str):
|
||||
"""Returns the announce title of a post containing names of participants
|
||||
x announces y
|
||||
"""
|
||||
titleStr = ''
|
||||
replyAvatarImageInPost = ''
|
||||
if not showRepeatIcon:
|
||||
return (titleStr, replyAvatarImageInPost,
|
||||
containerClassIcons, containerClass)
|
||||
|
||||
if isAnnounced:
|
||||
if postJsonObject['object'].get('attributedTo'):
|
||||
attributedTo = ''
|
||||
if isinstance(postJsonObject['object']['attributedTo'], str):
|
||||
attributedTo = postJsonObject['object']['attributedTo']
|
||||
|
||||
if attributedTo.startswith(postActor):
|
||||
titleStr += \
|
||||
' <img loading="lazy" title="' + \
|
||||
translate['announces'] + \
|
||||
'" alt="' + translate['announces'] + \
|
||||
'" src="/' + iconsPath + \
|
||||
'/repeat_inactive.png" class="announceOrReply"/>\n'
|
||||
titleStr += boostOwnTootHtml(translate, iconsPath)
|
||||
else:
|
||||
# boosting another person's post
|
||||
# benchmark 13.2
|
||||
if enableTimingLog:
|
||||
timeDiff = int((time.time() - postStartTime) * 1000)
|
||||
|
@ -792,25 +809,63 @@ def getPostTitleHtml(baseDir: str,
|
|||
announceDomain + '</a>\n'
|
||||
else:
|
||||
titleStr += \
|
||||
' <img loading="lazy" title="' + \
|
||||
translate['announces'] + '" alt="' + \
|
||||
translate['announces'] + '" src="/' + iconsPath + \
|
||||
'/repeat_inactive.png" ' + \
|
||||
'class="announceOrReply"/>\n' + \
|
||||
' <a href="' + \
|
||||
postJsonObject['object']['id'] + \
|
||||
'" class="announceOrReply">@unattributed</a>\n'
|
||||
announceUnattributedHtml(translate, iconsPath)
|
||||
else:
|
||||
titleStr += \
|
||||
' ' + \
|
||||
'<img loading="lazy" title="' + translate['announces'] + \
|
||||
'" alt="' + translate['announces'] + \
|
||||
'" src="/' + iconsPath + \
|
||||
'/repeat_inactive.png" ' + \
|
||||
'class="announceOrReply"/>\n' + \
|
||||
' <a href="' + \
|
||||
postJsonObject['object']['id'] + '" ' + \
|
||||
'class="announceOrReply">@unattributed</a>\n'
|
||||
announceUnattributedHtml(translate, iconsPath)
|
||||
|
||||
return (titleStr, replyAvatarImageInPost,
|
||||
containerClassIcons, containerClass)
|
||||
|
||||
|
||||
def getPostTitleHtml(baseDir: str,
|
||||
httpPrefix: str,
|
||||
nickname: str, domain: str,
|
||||
showRepeatIcon: bool,
|
||||
isAnnounced: bool,
|
||||
postJsonObject: {},
|
||||
postActor: str,
|
||||
translate: {},
|
||||
iconsPath: str,
|
||||
enableTimingLog: bool,
|
||||
postStartTime,
|
||||
boxName: str,
|
||||
personCache: {},
|
||||
allowDownloads: bool,
|
||||
avatarPosition: str,
|
||||
pageNumber: int,
|
||||
messageIdStr: str,
|
||||
containerClassIcons: str,
|
||||
containerClass: str) -> (str, str, str, str):
|
||||
"""Returns the title of a post containing names of participants
|
||||
x replies to y, x announces y, etc
|
||||
"""
|
||||
titleStr = ''
|
||||
replyAvatarImageInPost = ''
|
||||
if not showRepeatIcon:
|
||||
return (titleStr, replyAvatarImageInPost,
|
||||
containerClassIcons, containerClass)
|
||||
|
||||
if isAnnounced:
|
||||
return getPostTitleAnnounceHtml(baseDir,
|
||||
httpPrefix,
|
||||
nickname, domain,
|
||||
showRepeatIcon,
|
||||
isAnnounced,
|
||||
postJsonObject,
|
||||
postActor,
|
||||
translate,
|
||||
iconsPath,
|
||||
enableTimingLog,
|
||||
postStartTime,
|
||||
boxName,
|
||||
personCache,
|
||||
allowDownloads,
|
||||
avatarPosition,
|
||||
pageNumber,
|
||||
messageIdStr,
|
||||
containerClassIcons,
|
||||
containerClass)
|
||||
else:
|
||||
if postJsonObject['object'].get('inReplyTo'):
|
||||
containerClassIcons = 'containericons darker'
|
||||
|
|
Loading…
Reference in New Issue