fixes to react and tested

This commit is contained in:
simonwt 2026-04-03 00:07:39 +01:00
parent 60351f7cdb
commit 8704ad0e70
6 changed files with 26 additions and 11 deletions

View file

@ -1,2 +1,2 @@
from .react import create
from .reacttosomething import reacttosomething
from .listbyparent import listbyparent

View file

@ -0,0 +1 @@
from .react import react

View file

@ -23,25 +23,29 @@ def react(reaction_type: str, parent_path: str, item_path: str):
'''
slug = item_path.split('/')[-1]
if item_path.startswith('/post'):
# It's a reaction on a post
top_level_parent_pk = get_parent_pksk_from_path(parent_path)
item_pksk = get_post_pksk(top_level_parent_pk, item_path)
entity = 'post'
else:
# It's a reaction on a comment
item_pksk = {
'pk': make_post_sk(parent_path),
'sk': make_comment_sk(item_path)
}
entity = 'comment'
return {
"job_function": "reaction.react",
"job_function": "reaction.reacttosomething",
"payload": {
"reaction": reaction_type,
"parent": {
"pk": item_pksk.get('pk', None),
"sk": item_pksk.get('sk', None),
"entity": entity,
"slug": slug
}
}
}