create-update-shout-fix
Some checks failed
Deploy to core / deploy (push) Failing after 46s

This commit is contained in:
2024-02-17 09:35:11 +03:00
parent 6ef2c47e11
commit 92246bc9d1
3 changed files with 4 additions and 3 deletions

View File

@@ -67,7 +67,7 @@ async def create_shout(_, info, inp):
session.add(new_shout)
session.commit()
# NOTE: shout made by one author
# NOTE: requesting new shout back
shout = session.query(Shout).where(Shout.slug == slug).first()
if shout:
shout_dict = shout.dict()
@@ -84,7 +84,7 @@ async def create_shout(_, info, inp):
# notifier
# await notify_shout(shout_dict, 'create')
return {'shout': shout_dict}
return { 'shout': shout.dict() }
return {'error': 'cant create shout'}
@@ -178,6 +178,7 @@ async def update_shout(_, info, shout_id, shout_input=None, publish=False):
.filter(Shout.id == shout_id)
.first()
)
if not shout:
return {'error': 'shout not found'}
if shout.created_by is not author.id and author.id not in shout.authors and 'editor' not in roles: