Skip to content
Permalink
Browse files

Fix formatting

  • Loading branch information
tsileo committed Jan 26, 2020
1 parent f2f541c commit 8f0e167e430cb5985880ef976e1414f8cb50f866
Showing with 16 additions and 4 deletions.
  1. +16 −4 core/inbox.py
@@ -175,19 +175,31 @@ def _like_process_inbox(like: ap.Like, new_meta: _NewMeta) -> None:


@process_inbox.register
def _emoji_reaction_process_inbox(emoji_reaction: ap.EmojiReaction, new_meta: _NewMeta) -> None:
def _emoji_reaction_process_inbox(
emoji_reaction: ap.EmojiReaction, new_meta: _NewMeta
) -> None:
_logger.info(f"process_inbox activity={emoji_reaction!r}")
obj = emoji_reaction.get_object()
# Try to update an existing emoji reaction counter entry for the activity emoji
if not update_one_activity(
{**by_type(ap.ActivityType.CREATE), **by_object_id(obj.id),
"meta.emoji_reactions.emoji": emoji_reaction.content},
{
**by_type(ap.ActivityType.CREATE),
**by_object_id(obj.id),
"meta.emoji_reactions.emoji": emoji_reaction.content,
},
{"$inc": {"meta.emoji_reactions.$.count": 1}},
):
# Bootstrap the current emoji counter
update_one_activity(
{**by_type(ap.ActivityType.CREATE), **by_object_id(obj.id)},
{"$push": {"meta.emoji_reactions": {"emoji": emoji_reaction.content, "count": 1}}},
{
"$push": {
"meta.emoji_reactions": {
"emoji": emoji_reaction.content,
"count": 1,
}
}
},
)


0 comments on commit 8f0e167

Please sign in to comment.
You can’t perform that action at this time.