diff --git a/reaction.py b/reaction.py
index f364cabd2..531f41ac0 100644
--- a/reaction.py
+++ b/reaction.py
@@ -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:
diff --git a/webapp_post.py b/webapp_post.py
index fb32d3d56..9bdb02f26 100644
--- a/webapp_post.py
+++ b/webapp_post.py
@@ -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 = '
' + reactionStr
postHtml = '