Revert "Feature/lint"
This commit is contained in:
@@ -1,12 +1,17 @@
|
||||
import asyncio
|
||||
from base.orm import local_session
|
||||
from base.resolvers import mutation
|
||||
from auth.authenticate import login_required
|
||||
from auth.credentials import AuthCredentials
|
||||
from base.resolvers import mutation
|
||||
|
||||
# from resolvers.community import community_follow, community_unfollow
|
||||
from orm.user import AuthorFollower
|
||||
from orm.topic import TopicFollower
|
||||
from orm.shout import ShoutReactionsFollower
|
||||
from resolvers.zine.profile import author_follow, author_unfollow
|
||||
from resolvers.zine.reactions import reactions_follow, reactions_unfollow
|
||||
from resolvers.zine.topics import topic_follow, topic_unfollow
|
||||
from services.following import FollowingManager, FollowingResult
|
||||
from services.following import Following, FollowingManager, FollowingResult
|
||||
from graphql.type import GraphQLResolveInfo
|
||||
|
||||
|
||||
@mutation.field("follow")
|
||||
@@ -17,20 +22,20 @@ async def follow(_, info, what, slug):
|
||||
try:
|
||||
if what == "AUTHOR":
|
||||
if author_follow(auth.user_id, slug):
|
||||
result = FollowingResult("NEW", "author", slug)
|
||||
await FollowingManager.push("author", result)
|
||||
result = FollowingResult("NEW", 'author', slug)
|
||||
await FollowingManager.push('author', result)
|
||||
elif what == "TOPIC":
|
||||
if topic_follow(auth.user_id, slug):
|
||||
result = FollowingResult("NEW", "topic", slug)
|
||||
await FollowingManager.push("topic", result)
|
||||
result = FollowingResult("NEW", 'topic', slug)
|
||||
await FollowingManager.push('topic', result)
|
||||
elif what == "COMMUNITY":
|
||||
if False: # TODO: use community_follow(auth.user_id, slug):
|
||||
result = FollowingResult("NEW", "community", slug)
|
||||
await FollowingManager.push("community", result)
|
||||
result = FollowingResult("NEW", 'community', slug)
|
||||
await FollowingManager.push('community', result)
|
||||
elif what == "REACTIONS":
|
||||
if reactions_follow(auth.user_id, slug):
|
||||
result = FollowingResult("NEW", "shout", slug)
|
||||
await FollowingManager.push("shout", result)
|
||||
result = FollowingResult("NEW", 'shout', slug)
|
||||
await FollowingManager.push('shout', result)
|
||||
except Exception as e:
|
||||
print(Exception(e))
|
||||
return {"error": str(e)}
|
||||
@@ -46,20 +51,20 @@ async def unfollow(_, info, what, slug):
|
||||
try:
|
||||
if what == "AUTHOR":
|
||||
if author_unfollow(auth.user_id, slug):
|
||||
result = FollowingResult("DELETED", "author", slug)
|
||||
await FollowingManager.push("author", result)
|
||||
result = FollowingResult("DELETED", 'author', slug)
|
||||
await FollowingManager.push('author', result)
|
||||
elif what == "TOPIC":
|
||||
if topic_unfollow(auth.user_id, slug):
|
||||
result = FollowingResult("DELETED", "topic", slug)
|
||||
await FollowingManager.push("topic", result)
|
||||
result = FollowingResult("DELETED", 'topic', slug)
|
||||
await FollowingManager.push('topic', result)
|
||||
elif what == "COMMUNITY":
|
||||
if False: # TODO: use community_unfollow(auth.user_id, slug):
|
||||
result = FollowingResult("DELETED", "community", slug)
|
||||
await FollowingManager.push("community", result)
|
||||
result = FollowingResult("DELETED", 'community', slug)
|
||||
await FollowingManager.push('community', result)
|
||||
elif what == "REACTIONS":
|
||||
if reactions_unfollow(auth.user_id, slug):
|
||||
result = FollowingResult("DELETED", "shout", slug)
|
||||
await FollowingManager.push("shout", result)
|
||||
result = FollowingResult("DELETED", 'shout', slug)
|
||||
await FollowingManager.push('shout', result)
|
||||
except Exception as e:
|
||||
return {"error": str(e)}
|
||||
|
||||
|
Reference in New Issue
Block a user