forked from indymedia/epicyon
Function for showing title on reply posts
parent
c6e947f22e
commit
1942679172
123
webapp_post.py
123
webapp_post.py
|
@ -840,7 +840,17 @@ def getPostTitleAnnounceHtml(baseDir: str,
|
||||||
containerClassIcons, containerClass)
|
containerClassIcons, containerClass)
|
||||||
|
|
||||||
|
|
||||||
def getPostTitleHtml(baseDir: str,
|
def replyToYourselfHtml(translate: {}, iconsPath: str) -> str:
|
||||||
|
"""Returns html for a title which is a reply to yourself
|
||||||
|
"""
|
||||||
|
return ' <img loading="lazy" title="' + \
|
||||||
|
translate['replying to themselves'] + \
|
||||||
|
'" alt="' + translate['replying to themselves'] + \
|
||||||
|
'" src="/' + iconsPath + \
|
||||||
|
'/reply.png" class="announceOrReply"/>\n'
|
||||||
|
|
||||||
|
|
||||||
|
def getPostTitleReplyHtml(baseDir: str,
|
||||||
httpPrefix: str,
|
httpPrefix: str,
|
||||||
nickname: str, domain: str,
|
nickname: str, domain: str,
|
||||||
showRepeatIcon: bool,
|
showRepeatIcon: bool,
|
||||||
|
@ -859,47 +869,23 @@ def getPostTitleHtml(baseDir: str,
|
||||||
messageIdStr: str,
|
messageIdStr: str,
|
||||||
containerClassIcons: str,
|
containerClassIcons: str,
|
||||||
containerClass: str) -> (str, str, str, str):
|
containerClass: str) -> (str, str, str, str):
|
||||||
"""Returns the title of a post containing names of participants
|
"""Returns the reply title of a post containing names of participants
|
||||||
x replies to y, x announces y, etc
|
x replies to y
|
||||||
"""
|
"""
|
||||||
titleStr = ''
|
titleStr = ''
|
||||||
replyAvatarImageInPost = ''
|
replyAvatarImageInPost = ''
|
||||||
if not showRepeatIcon:
|
|
||||||
|
if not postJsonObject['object'].get('inReplyTo'):
|
||||||
return (titleStr, replyAvatarImageInPost,
|
return (titleStr, replyAvatarImageInPost,
|
||||||
containerClassIcons, containerClass)
|
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'
|
containerClassIcons = 'containericons darker'
|
||||||
containerClass = 'container darker'
|
containerClass = 'container darker'
|
||||||
if postJsonObject['object']['inReplyTo'].startswith(postActor):
|
if postJsonObject['object']['inReplyTo'].startswith(postActor):
|
||||||
titleStr += \
|
titleStr += replyToYourselfHtml(translate, iconsPath)
|
||||||
' <img loading="lazy" title="' + \
|
return (titleStr, replyAvatarImageInPost,
|
||||||
translate['replying to themselves'] + \
|
containerClassIcons, containerClass)
|
||||||
'" alt="' + translate['replying to themselves'] + \
|
|
||||||
'" src="/' + iconsPath + \
|
|
||||||
'/reply.png" class="announceOrReply"/>\n'
|
|
||||||
else:
|
|
||||||
if '/statuses/' in postJsonObject['object']['inReplyTo']:
|
if '/statuses/' in postJsonObject['object']['inReplyTo']:
|
||||||
inReplyTo = postJsonObject['object']['inReplyTo']
|
inReplyTo = postJsonObject['object']['inReplyTo']
|
||||||
replyActor = inReplyTo.split('/statuses/')[0]
|
replyActor = inReplyTo.split('/statuses/')[0]
|
||||||
|
@ -1051,10 +1037,81 @@ def getPostTitleHtml(baseDir: str,
|
||||||
postJsonObject['object']['inReplyTo'] + \
|
postJsonObject['object']['inReplyTo'] + \
|
||||||
'" class="announceOrReply">' + \
|
'" class="announceOrReply">' + \
|
||||||
postDomain + '</a>\n'
|
postDomain + '</a>\n'
|
||||||
|
|
||||||
return (titleStr, replyAvatarImageInPost,
|
return (titleStr, replyAvatarImageInPost,
|
||||||
containerClassIcons, containerClass)
|
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)
|
||||||
|
|
||||||
|
return getPostTitleReplyHtml(baseDir,
|
||||||
|
httpPrefix,
|
||||||
|
nickname, domain,
|
||||||
|
showRepeatIcon,
|
||||||
|
isAnnounced,
|
||||||
|
postJsonObject,
|
||||||
|
postActor,
|
||||||
|
translate,
|
||||||
|
iconsPath,
|
||||||
|
enableTimingLog,
|
||||||
|
postStartTime,
|
||||||
|
boxName,
|
||||||
|
personCache,
|
||||||
|
allowDownloads,
|
||||||
|
avatarPosition,
|
||||||
|
pageNumber,
|
||||||
|
messageIdStr,
|
||||||
|
containerClassIcons,
|
||||||
|
containerClass)
|
||||||
|
|
||||||
|
|
||||||
def individualPostAsHtml(allowDownloads: bool,
|
def individualPostAsHtml(allowDownloads: bool,
|
||||||
recentPostsCache: {}, maxRecentPosts: int,
|
recentPostsCache: {}, maxRecentPosts: int,
|
||||||
iconsPath: str, translate: {},
|
iconsPath: str, translate: {},
|
||||||
|
|
Loading…
Reference in New Issue