Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Q&A sort: always show OP replies
Browse files Browse the repository at this point in the history
As a few users have pointed out, it doesn't make much sense for OP replies to
be hidden in Q&A sort due to downvotes, since the entire point of the sort is
to make it easier to find what they're saying.

So now we'll override the comment score threshold for those particular comments
while in Q&A sort.
  • Loading branch information
xiongchiamiov committed Jun 1, 2015
1 parent f07095d commit fa63e43
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions r2/r2/models/builder.py
Expand Up @@ -990,6 +990,10 @@ def _make_wrapped_tree(self):
comment.edits_visible = self.edits_visible

parent = wrapped_by_id.get(comment.parent_id)
if qa_sort_hiding:
author_is_special = comment.author_id in special_responder_ids
else:
author_is_special = False

# In the Q&A sort type, we want to collapse all comments other than
# those that are:
Expand All @@ -1002,20 +1006,20 @@ def _make_wrapped_tree(self):
# comments).
if (qa_sort_hiding and
depth[comment._id] != 0 and # (1)
comment.author_id not in special_responder_ids and # (2)
not author_is_special and # (2)
not (parent and
parent.author_id in special_responder_ids and
feature.is_enabled('qa_show_replies')) and # (4)
not comment.prevent_collapse): # (5)
comment.hidden = True

if comment.collapsed and comment._id in dont_collapse:
comment.collapsed = False
comment.hidden = False
if comment.collapsed:
if comment._id in dont_collapse or author_is_special:
comment.collapsed = False
comment.hidden = False

if parent:
if (qa_sort_hiding and
comment.author_id in special_responder_ids):
if author_is_special:
# Un-collapse parents as necessary. It's a lot easier to
# do this here, upwards, than to check through all the
# children when we were iterating at the parent.
Expand Down

0 comments on commit fa63e43

Please sign in to comment.