# HG changeset patch # User neko259 # Date 2017-12-14 11:26:18 # Node ID 4249fd1b82cc525db796f7b193ab24b10913db8e # Parent d400283571bd69972929f7cce44147753de588c2 Fixed loading of first level posts in tree view diff --git a/boards/models/thread.py b/boards/models/thread.py --- a/boards/models/thread.py +++ b/boards/models/thread.py @@ -312,15 +312,15 @@ class Thread(models.Model): searching_for_index = True parent_depth = depth - if not found_parent: - tree.append((0, reply)) - else: - if searching_for_index: - tree.append((parent_depth + 1, reply)) + if not found_parent: + tree.append((0, reply)) + else: + if searching_for_index: + tree.append((parent_depth + 1, reply)) - offset = 0 - for last_index, parent_depth in indexes_to_insert: - tree.insert(last_index + offset, (parent_depth + 1, reply)) - offset += 1 + offset = 0 + for last_index, parent_depth in indexes_to_insert: + tree.insert(last_index + offset, (parent_depth + 1, reply)) + offset += 1 return tree