rm-reaction-fix

This commit is contained in:
Untone 2024-03-07 10:18:05 +03:00
parent c84aae40d3
commit e378cbd442

View File

@ -303,11 +303,11 @@ async def delete_reaction(_, info, reaction_id: int):
return {'error': 'access denied'} return {'error': 'access denied'}
logger.debug(f'{user_id} user removing his #{reaction_id} reaction') logger.debug(f'{user_id} user removing his #{reaction_id} reaction')
reaction_dict = r.dict()
if r.kind in [ReactionKind.LIKE.value, ReactionKind.DISLIKE.value]:
session.delete(r) session.delete(r)
session.commit() session.commit()
await notify_reaction(r.dict(), 'delete') await notify_reaction(reaction_dict, 'delete')
return {'error': None, 'reaction': reaction_dict}
except Exception as exc: except Exception as exc:
return {'error': f'cannot delete reaction: {exc}'} return {'error': f'cannot delete reaction: {exc}'}
return {'error': 'cannot delete reaction'} return {'error': 'cannot delete reaction'}