mirror of https://gitlab.com/bashrc2/epicyon
Limit the number of reaction types which can be shown on a post
parent
bdd63be131
commit
af69491fe9
|
@ -502,7 +502,7 @@ def updateReactionCollection(recentPostsCache: {},
|
|||
|
||||
|
||||
def htmlEmojiReactions(postJsonObject: {}, interactive: bool,
|
||||
actor: str) -> str:
|
||||
actor: str, maxReactionTypes: int) -> str:
|
||||
"""html containing row of emoji reactions
|
||||
"""
|
||||
if not hasObjectDict(postJsonObject):
|
||||
|
@ -515,7 +515,8 @@ def htmlEmojiReactions(postJsonObject: {}, interactive: bool,
|
|||
for item in postJsonObject['object']['reactions']['items']:
|
||||
emojiContent = item['content']
|
||||
if not reactions.get(emojiContent):
|
||||
reactions[emojiContent] = 1
|
||||
if len(reactions.items()) < maxReactionTypes:
|
||||
reactions[emojiContent] = 1
|
||||
else:
|
||||
reactions[emojiContent] += 1
|
||||
if len(reactions.items()) == 0:
|
||||
|
|
|
@ -1304,6 +1304,10 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
|
|||
if not postJsonObject:
|
||||
return ''
|
||||
|
||||
# maximum number of different emoji reactions which can
|
||||
# be added to a post
|
||||
maxReactionTypes = 5
|
||||
|
||||
# benchmark
|
||||
postStartTime = time.time()
|
||||
|
||||
|
@ -1882,7 +1886,9 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
|
|||
if boxName != 'tlmedia':
|
||||
reactionStr = ''
|
||||
if showIcons:
|
||||
reactionStr = htmlEmojiReactions(postJsonObject, True, personUrl)
|
||||
reactionStr = \
|
||||
htmlEmojiReactions(postJsonObject, True, personUrl,
|
||||
maxReactionTypes)
|
||||
if postIsSensitive and reactionStr:
|
||||
reactionStr = '<br>' + reactionStr
|
||||
postHtml = ' <div id="' + timelinePostBookmark + \
|
||||
|
|
Loading…
Reference in New Issue