follow-fix

This commit is contained in:
Untone 2024-03-11 12:03:41 +03:00
parent 1162c62a9b
commit 5f7087b0df

View File

@ -12,7 +12,7 @@ from orm.reaction import Reaction
from orm.shout import Shout, ShoutReactionsFollower from orm.shout import Shout, ShoutReactionsFollower
from orm.topic import Topic, TopicFollower from orm.topic import Topic, TopicFollower
from resolvers.community import community_follow, community_unfollow from resolvers.community import community_follow, community_unfollow
from resolvers.topic import topic_unfollow from resolvers.topic import topic_unfollow, topic_follow
from resolvers.stat import get_with_stat, author_follows_topics, author_follows_authors from resolvers.stat import get_with_stat, author_follows_topics, author_follows_authors
from services.auth import login_required from services.auth import login_required
from services.db import local_session from services.db import local_session
@ -39,7 +39,7 @@ async def follow(_, info, what, slug):
[follower] = get_with_stat(follower_query) [follower] = get_with_stat(follower_query)
if follower: if follower:
if what == 'AUTHOR': if what == 'AUTHOR':
if author_unfollow(follower.id, slug): if author_follow(follower.id, slug):
author_query = ( author_query = (
select(Author).select_from(Author).where(Author.slug == slug) select(Author).select_from(Author).where(Author.slug == slug)
) )
@ -57,7 +57,7 @@ async def follow(_, info, what, slug):
follows = await update_follows_for_author( follows = await update_follows_for_author(
follower, 'topic', topic, True follower, 'topic', topic, True
) )
topic_unfollow(follower.id, slug) topic_follow(follower.id, slug)
elif what == 'COMMUNITY': elif what == 'COMMUNITY':
community_follow(follower.id, slug) community_follow(follower.id, slug)
elif what == 'REACTIONS': elif what == 'REACTIONS':