follow/unfollow-handling-noauthor
This commit is contained in:
parent
71c2e8ea13
commit
e0b3562e80
|
@ -41,10 +41,10 @@ async def cache_by_slug(what: str, slug: str):
|
||||||
async def follow(_, info, what, slug):
|
async def follow(_, info, what, slug):
|
||||||
error = None
|
error = None
|
||||||
user_id = info.context.get("user_id")
|
user_id = info.context.get("user_id")
|
||||||
follower_dict = info.context["author"]
|
follower_dict = info.context.get("author")
|
||||||
follower_id = follower_dict.get("id")
|
if not user_id or not follower_dict:
|
||||||
if not user_id or not follower_id:
|
|
||||||
return {"error": "unauthorized"}
|
return {"error": "unauthorized"}
|
||||||
|
follower_id = follower_dict.get("id")
|
||||||
|
|
||||||
entity = what.lower()
|
entity = what.lower()
|
||||||
follows = []
|
follows = []
|
||||||
|
@ -91,13 +91,10 @@ async def unfollow(_, info, what, slug):
|
||||||
follows = []
|
follows = []
|
||||||
error = None
|
error = None
|
||||||
user_id = info.context.get("user_id")
|
user_id = info.context.get("user_id")
|
||||||
follower_dict = info.context["author"]
|
follower_dict = info.context.get("author")
|
||||||
follower_id = follower_dict.get("id")
|
if not user_id or not follower_dict:
|
||||||
if not user_id:
|
|
||||||
return {"error": "unauthorized"}
|
return {"error": "unauthorized"}
|
||||||
|
follower_id = follower_dict.get("id")
|
||||||
if not follower_id:
|
|
||||||
return {"error": "cant find follower account"}
|
|
||||||
|
|
||||||
entity = what.lower()
|
entity = what.lower()
|
||||||
follows = []
|
follows = []
|
||||||
|
|
Loading…
Reference in New Issue
Block a user