author-id-fix
This commit is contained in:
parent
10f8faccdd
commit
b45ad1082d
|
@ -146,11 +146,9 @@ def load_authors_by(_, _info, by, limit, offset):
|
||||||
async def get_author_follows(_, _info, slug='', user=None, author_id=None):
|
async def get_author_follows(_, _info, slug='', user=None, author_id=None):
|
||||||
with (local_session() as session):
|
with (local_session() as session):
|
||||||
if user or slug:
|
if user or slug:
|
||||||
(author_id, ) = (
|
author = session.query(Author).filter(or_(Author.user == user, Author.slug == slug)).first()
|
||||||
session.query(Author.id)
|
if author:
|
||||||
.filter(or_(Author.user == user, Author.slug == slug))
|
author_id = author.id
|
||||||
.first()
|
|
||||||
)
|
|
||||||
if author_id:
|
if author_id:
|
||||||
rkey = f'author:{author_id}:follows-authors'
|
rkey = f'author:{author_id}:follows-authors'
|
||||||
logger.debug(f'getting {author_id} follows authors')
|
logger.debug(f'getting {author_id} follows authors')
|
||||||
|
|
|
@ -40,10 +40,7 @@ async def follow(_, info, what, slug):
|
||||||
if follower:
|
if follower:
|
||||||
if what == 'AUTHOR':
|
if what == 'AUTHOR':
|
||||||
if author_follow(follower.id, slug):
|
if author_follow(follower.id, slug):
|
||||||
author_query = (
|
[author] = get_with_stat(select(Author).select_from(Author).where(Author.slug == slug))
|
||||||
select(Author).select_from(Author).where(Author.slug == slug)
|
|
||||||
)
|
|
||||||
[author] = get_with_stat(author_query)
|
|
||||||
if author:
|
if author:
|
||||||
follows = await update_follows_for_author(
|
follows = await update_follows_for_author(
|
||||||
follower, 'author', author, True
|
follower, 'author', author, True
|
||||||
|
|
Loading…
Reference in New Issue
Block a user