update-shout-fix
Some checks failed
Deploy on push / deploy (push) Failing after 19s

This commit is contained in:
Untone 2024-03-05 16:59:55 +03:00
parent 130942d9dd
commit 12a9880815
2 changed files with 7 additions and 6 deletions

View File

@ -175,12 +175,12 @@ def patch_topics(session, shout, topics_input):
@mutation.field('update_shout') @mutation.field('update_shout')
@login_required @login_required
async def update_shout(_, info, shout_id, shout_input=None, publish=False): async def update_shout(_, info, shout_id, shout_input=None, publish=False):
try:
user_id = info.context.get('user_id') user_id = info.context.get('user_id')
if not user_id:
return {"error": "unauthorized"}
roles = info.context.get('roles', []) roles = info.context.get('roles', [])
shout_input = shout_input or {} shout_input = shout_input or {}
if not user_id:
return {"error": "unauthorized"}
try:
with local_session() as session: with local_session() as session:
author = session.query(Author).filter(Author.user == user_id).first() author = session.query(Author).filter(Author.user == user_id).first()
current_time = int(time.time()) current_time = int(time.time())
@ -206,7 +206,7 @@ async def update_shout(_, info, shout_id, shout_input=None, publish=False):
) )
shout_input['slug'] = slug shout_input['slug'] = slug
if isinstance(author, Author) and isinstance(shout_id, int): if author and isinstance(shout_id, int):
shout = ( shout = (
session.query(Shout) session.query(Shout)
.options(joinedload(Shout.authors), joinedload(Shout.topics)) .options(joinedload(Shout.authors), joinedload(Shout.topics))

View File

@ -229,6 +229,7 @@ async def load_shouts_by(_, _info, options):
return shouts return shouts
@login_required @login_required
@query.field('load_shouts_drafts') @query.field('load_shouts_drafts')
async def load_shouts_drafts(_, info): async def load_shouts_drafts(_, info):