forked from indymedia/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
|
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,
|
httpPrefix: str,
|
||||||
nickname: str, domain: str,
|
nickname: str, domain: str,
|
||||||
showRepeatIcon: bool,
|
showRepeatIcon: bool,
|
||||||
|
@ -669,29 +693,22 @@ def getPostTitleHtml(baseDir: str,
|
||||||
pageNumber: int,
|
pageNumber: int,
|
||||||
messageIdStr: str,
|
messageIdStr: str,
|
||||||
containerClassIcons: str,
|
containerClassIcons: str,
|
||||||
containerClass: str) -> (str, str):
|
containerClass: str) -> (str, str, str, str):
|
||||||
"""Returns the title of a post containing names of participants
|
"""Returns the announce title of a post containing names of participants
|
||||||
x replies to y, x announces y, etc
|
x announces y
|
||||||
"""
|
"""
|
||||||
titleStr = ''
|
titleStr = ''
|
||||||
replyAvatarImageInPost = ''
|
replyAvatarImageInPost = ''
|
||||||
if not showRepeatIcon:
|
|
||||||
return (titleStr, replyAvatarImageInPost,
|
|
||||||
containerClassIcons, containerClass)
|
|
||||||
|
|
||||||
if isAnnounced:
|
|
||||||
if postJsonObject['object'].get('attributedTo'):
|
if postJsonObject['object'].get('attributedTo'):
|
||||||
attributedTo = ''
|
attributedTo = ''
|
||||||
if isinstance(postJsonObject['object']['attributedTo'], str):
|
if isinstance(postJsonObject['object']['attributedTo'], str):
|
||||||
attributedTo = postJsonObject['object']['attributedTo']
|
attributedTo = postJsonObject['object']['attributedTo']
|
||||||
|
|
||||||
if attributedTo.startswith(postActor):
|
if attributedTo.startswith(postActor):
|
||||||
titleStr += \
|
titleStr += boostOwnTootHtml(translate, iconsPath)
|
||||||
' <img loading="lazy" title="' + \
|
|
||||||
translate['announces'] + \
|
|
||||||
'" alt="' + translate['announces'] + \
|
|
||||||
'" src="/' + iconsPath + \
|
|
||||||
'/repeat_inactive.png" class="announceOrReply"/>\n'
|
|
||||||
else:
|
else:
|
||||||
|
# boosting another person's post
|
||||||
# benchmark 13.2
|
# benchmark 13.2
|
||||||
if enableTimingLog:
|
if enableTimingLog:
|
||||||
timeDiff = int((time.time() - postStartTime) * 1000)
|
timeDiff = int((time.time() - postStartTime) * 1000)
|
||||||
|
@ -792,25 +809,63 @@ def getPostTitleHtml(baseDir: str,
|
||||||
announceDomain + '</a>\n'
|
announceDomain + '</a>\n'
|
||||||
else:
|
else:
|
||||||
titleStr += \
|
titleStr += \
|
||||||
' <img loading="lazy" title="' + \
|
announceUnattributedHtml(translate, iconsPath)
|
||||||
translate['announces'] + '" alt="' + \
|
|
||||||
translate['announces'] + '" src="/' + iconsPath + \
|
|
||||||
'/repeat_inactive.png" ' + \
|
|
||||||
'class="announceOrReply"/>\n' + \
|
|
||||||
' <a href="' + \
|
|
||||||
postJsonObject['object']['id'] + \
|
|
||||||
'" class="announceOrReply">@unattributed</a>\n'
|
|
||||||
else:
|
else:
|
||||||
titleStr += \
|
titleStr += \
|
||||||
' ' + \
|
announceUnattributedHtml(translate, iconsPath)
|
||||||
'<img loading="lazy" title="' + translate['announces'] + \
|
|
||||||
'" alt="' + translate['announces'] + \
|
return (titleStr, replyAvatarImageInPost,
|
||||||
'" src="/' + iconsPath + \
|
containerClassIcons, containerClass)
|
||||||
'/repeat_inactive.png" ' + \
|
|
||||||
'class="announceOrReply"/>\n' + \
|
|
||||||
' <a href="' + \
|
def getPostTitleHtml(baseDir: str,
|
||||||
postJsonObject['object']['id'] + '" ' + \
|
httpPrefix: str,
|
||||||
'class="announceOrReply">@unattributed</a>\n'
|
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:
|
else:
|
||||||
if postJsonObject['object'].get('inReplyTo'):
|
if postJsonObject['object'].get('inReplyTo'):
|
||||||
containerClassIcons = 'containericons darker'
|
containerClassIcons = 'containericons darker'
|
||||||
|
|
Loading…
Reference in New Issue