|
|
@ -213,6 +213,8 @@ def story(story_id): |
|
|
|
story = Story.query.get_or_404(story_id) |
|
|
|
is_tree = story.is_tree |
|
|
|
|
|
|
|
draft = '' |
|
|
|
|
|
|
|
if is_tree: |
|
|
|
tail = request.args.get('tail', story.tail, type=int) |
|
|
|
p_tail = Paragraph.query.get_or_404(tail) |
|
|
@ -230,6 +232,14 @@ def story(story_id): |
|
|
|
story_id=story_id, is_chosen=True, is_hidden=False |
|
|
|
).all() |
|
|
|
|
|
|
|
if 'username' in session: |
|
|
|
last_post = Paragraph.query.filter_by( |
|
|
|
story_id=story_id, author=session['username'], is_chosen=False |
|
|
|
).order_by(Paragraph.id.desc()).first() |
|
|
|
|
|
|
|
if last_post and last_post.parent_id != tail: |
|
|
|
draft = last_post.text |
|
|
|
|
|
|
|
sort_by = request.args.get('sort_by', 'time') |
|
|
|
|
|
|
|
q = Paragraph.query.filter_by(story_id=story_id, parent_id=tail, is_hidden=False) |
|
|
|