mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-27 03:00:12 -04:00
MessageBuilder: cleanly skip over missing parents.
This wasn't an issue in flat mode because child messages were always attached to the root message.
This commit is contained in:
@@ -1251,7 +1251,12 @@ class MessageBuilder(Builder):
|
||||
for child in sorted(children, key=lambda child: child._id):
|
||||
# iterate from the root outwards so we can check the depth
|
||||
if self.threaded:
|
||||
child_parent = wrapped[child.parent_id]
|
||||
try:
|
||||
child_parent = wrapped[child.parent_id]
|
||||
except KeyError:
|
||||
# the stored comment tree was missing this message's
|
||||
# parent, treat it as a top level reply
|
||||
child_parent = parent
|
||||
else:
|
||||
# for flat view all messages are decendants of the
|
||||
# parent message
|
||||
|
||||
Reference in New Issue
Block a user