Skip to content

Commit afed00d

Browse files
committed
Q&A Sort: Display first level of responses to responders.
In use of Q&A sort, we've seen that community response to an answerer is an important part of the experience. This shows the first level of the responses to the OP, but keeps the rest collapsed for brevity.
1 parent 41de747 commit afed00d

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

r2/r2/models/builder.py

+11-6
Original file line numberDiff line numberDiff line change
@@ -983,25 +983,30 @@ def _make_wrapped_tree(self):
983983
comment.num_children = num_children[comment._id]
984984
comment.edits_visible = self.edits_visible
985985

986+
parent = wrapped_by_id.get(comment.parent_id)
987+
986988
# In the Q&A sort type, we want to collapse all comments other than
987989
# those that are:
988990
#
989991
# 1. Top-level comments,
990992
# 2. Responses from the OP(s),
991-
# 3. Responded to by the OP(s) (dealt with below), or
992-
# 4. Otherwise normally prevented from collapse (eg distinguished
993+
# 3. Responded to by the OP(s) (dealt with below),
994+
# 4. Within one level of an OP reply, or
995+
# 5. Otherwise normally prevented from collapse (eg distinguished
993996
# comments).
994997
if (qa_sort_hiding and
995-
depth[comment._id] != 0 and # (1)
996-
comment.author_id not in special_responder_ids and # (2)
997-
not comment.prevent_collapse): # (4)
998+
depth[comment._id] != 0 and # (1)
999+
comment.author_id not in special_responder_ids and # (2)
1000+
not (parent and
1001+
parent.author_id in special_responder_ids and
1002+
feature.is_enabled('qa_show_replies')) and # (4)
1003+
not comment.prevent_collapse): # (5)
9981004
comment.hidden = True
9991005

10001006
if comment.collapsed and comment._id in dont_collapse:
10011007
comment.collapsed = False
10021008
comment.hidden = False
10031009

1004-
parent = wrapped_by_id.get(comment.parent_id)
10051010
if parent:
10061011
if (qa_sort_hiding and
10071012
comment.author_id in special_responder_ids):

0 commit comments

Comments
 (0)