refactor: move unknown parent thread check
This commit is contained in:
parent
002fc63c90
commit
4228107b54
@ -95,7 +95,9 @@ async def reply_to_post(thread_id: int, data: PostCreate):
|
|||||||
if thread.id == thread_id:
|
if thread.id == thread_id:
|
||||||
parent = thread
|
parent = thread
|
||||||
|
|
||||||
if parent:
|
if parent is None:
|
||||||
|
return {'error': 'could not find parent thread'}
|
||||||
|
|
||||||
id = len(POSTS) + 1
|
id = len(POSTS) + 1
|
||||||
author = data.author
|
author = data.author
|
||||||
title = data.title
|
title = data.title
|
||||||
@ -112,5 +114,3 @@ async def reply_to_post(thread_id: int, data: PostCreate):
|
|||||||
POSTS.append(post)
|
POSTS.append(post)
|
||||||
|
|
||||||
return post
|
return post
|
||||||
|
|
||||||
return {'error': 'could not find parent thread'}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user