no-return-reaction-fix
This commit is contained in:
parent
3f65652a5f
commit
e2e85376f0
|
@ -263,15 +263,10 @@ async def create_reaction(_, info, reaction):
|
||||||
if opposite_reaction is not None:
|
if opposite_reaction is not None:
|
||||||
await notify_reaction(opposite_reaction, "delete")
|
await notify_reaction(opposite_reaction, "delete")
|
||||||
session.delete(opposite_reaction)
|
session.delete(opposite_reaction)
|
||||||
|
return {}
|
||||||
return {"reaction": reaction}
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
rdict = await _create_reaction(session, shout, author, reaction)
|
rdict = await _create_reaction(session, shout, author, reaction)
|
||||||
|
|
||||||
return {"reaction": rdict}
|
return {"reaction": rdict}
|
||||||
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
import traceback
|
import traceback
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
@ -335,18 +330,11 @@ async def delete_reaction(_, info, rid):
|
||||||
|
|
||||||
if r.kind in [ReactionKind.LIKE.value, ReactionKind.DISLIKE.value]:
|
if r.kind in [ReactionKind.LIKE.value, ReactionKind.DISLIKE.value]:
|
||||||
session.delete(r)
|
session.delete(r)
|
||||||
else:
|
|
||||||
rdict = r.dict()
|
|
||||||
rdict["deleted_at"] = int(time.time())
|
|
||||||
Reaction.update(r, rdict)
|
|
||||||
session.add(r)
|
|
||||||
session.commit()
|
session.commit()
|
||||||
|
|
||||||
await notify_reaction(r.dict(), "delete")
|
await notify_reaction(r.dict(), "delete")
|
||||||
|
|
||||||
return {"reaction": r}
|
|
||||||
else:
|
else:
|
||||||
return {"error": "access denied"}
|
return {"error": "access denied"}
|
||||||
|
return {}
|
||||||
|
|
||||||
|
|
||||||
def apply_reaction_filters(by, q):
|
def apply_reaction_filters(by, q):
|
||||||
|
|
|
@ -104,7 +104,7 @@ async def load_shouts_by(_, _info, options):
|
||||||
}
|
}
|
||||||
offset: 0
|
offset: 0
|
||||||
limit: 50
|
limit: 50
|
||||||
order_by: 'created_at' | 'commented' | 'reacted' | 'rating'
|
order_by: 'created_at' | 'commented' | 'likes_stat'
|
||||||
order_by_desc: true
|
order_by_desc: true
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user