This commit is contained in:
parent
7cd7447796
commit
b0e981ece4
|
@ -91,6 +91,8 @@ async def create_shout(_, info, inp):
|
||||||
@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):
|
||||||
user_id = info.context['user_id']
|
user_id = info.context['user_id']
|
||||||
|
if not shout_input:
|
||||||
|
shout_input = {}
|
||||||
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()
|
||||||
shout_dict = None
|
shout_dict = None
|
||||||
|
@ -109,7 +111,6 @@ async def update_shout(_, info, shout_id, shout_input=None, publish=False):
|
||||||
return {'error': 'shout not found'}
|
return {'error': 'shout not found'}
|
||||||
if shout.created_by is not author.id and author.id not in shout.authors:
|
if shout.created_by is not author.id and author.id not in shout.authors:
|
||||||
return {'error': 'access denied'}
|
return {'error': 'access denied'}
|
||||||
if shout_input is not None:
|
|
||||||
topics_input = shout_input['topics']
|
topics_input = shout_input['topics']
|
||||||
del shout_input['topics']
|
del shout_input['topics']
|
||||||
new_topics_to_link = [Topic(**new_topic) for new_topic in topics_input if new_topic['id'] < 0]
|
new_topics_to_link = [Topic(**new_topic) for new_topic in topics_input if new_topic['id'] < 0]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user