using presence service
This commit is contained in:
@@ -6,6 +6,9 @@ from resolvers.reactions import reactions_follow, reactions_unfollow
|
||||
from resolvers.topics import topic_follow, topic_unfollow
|
||||
from services.following import FollowingManager, FollowingResult
|
||||
from resolvers.community import community_follow, community_unfollow
|
||||
from services.presence import notify_follower
|
||||
from orm.user import Author
|
||||
from services.db import local_session
|
||||
|
||||
|
||||
@mutation.field("follow")
|
||||
@@ -18,6 +21,10 @@ async def follow(_, info, what, slug):
|
||||
if author_follow(auth.user_id, slug):
|
||||
result = FollowingResult("NEW", "author", slug)
|
||||
await FollowingManager.push("author", result)
|
||||
with local_session() as session:
|
||||
author_id = session.query(Author.id).where(Author.slug == slug).one()
|
||||
follower = session.query()
|
||||
notify_follower(follower.dict(), author_id)
|
||||
elif what == "TOPIC":
|
||||
if topic_follow(auth.user_id, slug):
|
||||
result = FollowingResult("NEW", "topic", slug)
|
||||
|
Reference in New Issue
Block a user