mirror of https://gitlab.com/bashrc2/epicyon
Reaction icon links react or unreact
parent
5a06cf762a
commit
862403054a
11
reaction.py
11
reaction.py
|
@ -521,8 +521,13 @@ def htmlEmojiReactions(postJsonObject: {}, interactive: bool,
|
||||||
if not postJsonObject['object']['reactions'].get('items'):
|
if not postJsonObject['object']['reactions'].get('items'):
|
||||||
return ''
|
return ''
|
||||||
reactions = {}
|
reactions = {}
|
||||||
|
reactedToByThisActor = []
|
||||||
for item in postJsonObject['object']['reactions']['items']:
|
for item in postJsonObject['object']['reactions']['items']:
|
||||||
emojiContent = item['content']
|
emojiContent = item['content']
|
||||||
|
emojiActor = item['actor']
|
||||||
|
if emojiActor == actor:
|
||||||
|
if emojiContent not in reactedToByThisActor:
|
||||||
|
reactedToByThisActor.append(emojiContent)
|
||||||
if not reactions.get(emojiContent):
|
if not reactions.get(emojiContent):
|
||||||
if len(reactions.items()) < maxReactionTypes:
|
if len(reactions.items()) < maxReactionTypes:
|
||||||
reactions[emojiContent] = 1
|
reactions[emojiContent] = 1
|
||||||
|
@ -531,9 +536,13 @@ def htmlEmojiReactions(postJsonObject: {}, interactive: bool,
|
||||||
if len(reactions.items()) == 0:
|
if len(reactions.items()) == 0:
|
||||||
return ''
|
return ''
|
||||||
reactBy = removeIdEnding(postJsonObject['object']['id'])
|
reactBy = removeIdEnding(postJsonObject['object']['id'])
|
||||||
baseUrl = actor + '?react=' + reactBy + '?emojreact='
|
|
||||||
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:
|
||||||
|
baseUrl = actor + '?react=' + reactBy + '?emojreact='
|
||||||
|
else:
|
||||||
|
baseUrl = actor + '?unreact=' + reactBy + '?emojreact='
|
||||||
|
|
||||||
htmlStr += ' <div class="emojiReactionButton">\n'
|
htmlStr += ' <div class="emojiReactionButton">\n'
|
||||||
if count < 100:
|
if count < 100:
|
||||||
countStr = str(count)
|
countStr = str(count)
|
||||||
|
|
Loading…
Reference in New Issue