From 1281596208ae7330b5acb25e3f5c1eb31dbfb0b0 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 12 Nov 2021 11:40:27 +0000 Subject: [PATCH 1/7] Extra options on reaction emoji links --- reaction.py | 13 ++++++++++--- webapp_post.py | 3 ++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/reaction.py b/reaction.py index 536dbc06e..e93b07235 100644 --- a/reaction.py +++ b/reaction.py @@ -514,11 +514,14 @@ def updateReactionCollection(recentPostsCache: {}, 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 """ if not hasObjectDict(postJsonObject): return '' + if not postJsonObject.get('actor'): + return '' if not postJsonObject['object'].get('reactions'): return '' if not postJsonObject['object']['reactions'].get('items'): @@ -542,9 +545,13 @@ def htmlEmojiReactions(postJsonObject: {}, interactive: bool, htmlStr = '
\n' for emojiContent, count in reactions.items(): if emojiContent not in reactedToByThisActor: - baseUrl = actor + '?react=' + reactBy + '?emojreact=' + baseUrl = actor + '?react=' + reactBy else: - baseUrl = actor + '?unreact=' + reactBy + '?emojreact=' + baseUrl = actor + '?unreact=' + reactBy + baseUrl += '?actor=' + postJsonObject['actor'] + baseUrl += '?tl=' + boxName + baseUrl += '?page=' + str(pageNumber) + baseUrl += '?emojreact=' htmlStr += '
\n' if count < 100: diff --git a/webapp_post.py b/webapp_post.py index 5f8fcc212..b5881c805 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -1937,7 +1937,8 @@ def individualPostAsHtml(signingPrivateKeyPem: str, if showIcons: reactionStr = \ htmlEmojiReactions(postJsonObject, True, personUrl, - maxReactionTypes) + maxReactionTypes, + boxName, pageNumber) if postIsSensitive and reactionStr: reactionStr = '
' + reactionStr postHtml = '