Extra options on reaction emoji links

merge-requests/30/head
Bob Mottram 2021-11-12 11:40:27 +00:00
parent 64e58fc365
commit 1281596208
2 changed files with 12 additions and 4 deletions

View File

@ -514,11 +514,14 @@ def updateReactionCollection(recentPostsCache: {},
def htmlEmojiReactions(postJsonObject: {}, interactive: bool, def htmlEmojiReactions(postJsonObject: {}, interactive: bool,
actor: str, maxReactionTypes: int) -> str: actor: str, maxReactionTypes: int,
boxName: str, pageNumber: int) -> str:
"""html containing row of emoji reactions """html containing row of emoji reactions
""" """
if not hasObjectDict(postJsonObject): if not hasObjectDict(postJsonObject):
return '' return ''
if not postJsonObject.get('actor'):
return ''
if not postJsonObject['object'].get('reactions'): if not postJsonObject['object'].get('reactions'):
return '' return ''
if not postJsonObject['object']['reactions'].get('items'): if not postJsonObject['object']['reactions'].get('items'):
@ -542,9 +545,13 @@ def htmlEmojiReactions(postJsonObject: {}, interactive: bool,
htmlStr = '<div class="emojiReactionBar">\n' htmlStr = '<div class="emojiReactionBar">\n'
for emojiContent, count in reactions.items(): for emojiContent, count in reactions.items():
if emojiContent not in reactedToByThisActor: if emojiContent not in reactedToByThisActor:
baseUrl = actor + '?react=' + reactBy + '?emojreact=' baseUrl = actor + '?react=' + reactBy
else: else:
baseUrl = actor + '?unreact=' + reactBy + '?emojreact=' baseUrl = actor + '?unreact=' + reactBy
baseUrl += '?actor=' + postJsonObject['actor']
baseUrl += '?tl=' + boxName
baseUrl += '?page=' + str(pageNumber)
baseUrl += '?emojreact='
htmlStr += ' <div class="emojiReactionButton">\n' htmlStr += ' <div class="emojiReactionButton">\n'
if count < 100: if count < 100:

View File

@ -1937,7 +1937,8 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
if showIcons: if showIcons:
reactionStr = \ reactionStr = \
htmlEmojiReactions(postJsonObject, True, personUrl, htmlEmojiReactions(postJsonObject, True, personUrl,
maxReactionTypes) maxReactionTypes,
boxName, pageNumber)
if postIsSensitive and reactionStr: if postIsSensitive and reactionStr:
reactionStr = '<br>' + reactionStr reactionStr = '<br>' + reactionStr
postHtml = ' <div id="' + timelinePostBookmark + \ postHtml = ' <div id="' + timelinePostBookmark + \