Change in API: hidden_replies field instead of passed_replies
This commit is contained in:
parent
3c3e83b05c
commit
a5d8a0cfe1
@ -356,19 +356,19 @@ class API(object):
|
|||||||
|
|
||||||
rv = {
|
rv = {
|
||||||
'id' : root_id,
|
'id' : root_id,
|
||||||
'passed_replies' : len(root_list),
|
|
||||||
'total_replies' : reply_counts[root_id],
|
'total_replies' : reply_counts[root_id],
|
||||||
|
'hidden_replies' : reply_counts[root_id] - len(root_list),
|
||||||
'replies' : self.process_fetched_list(root_list, plain)
|
'replies' : self.process_fetched_list(root_list, plain)
|
||||||
}
|
}
|
||||||
# We are only checking for one level deep comments
|
# We are only checking for one level deep comments
|
||||||
if root_id is None:
|
if root_id is None:
|
||||||
for comment in rv['replies']:
|
for comment in rv['replies']:
|
||||||
replies = [i for i in full_list if i['parent'] == comment['id']]
|
replies = [i for i in full_list if i['parent'] == comment['id']]
|
||||||
comment['passed_replies'] = len(replies)
|
|
||||||
if comment['id'] in reply_counts:
|
if comment['id'] in reply_counts:
|
||||||
comment['total_replies'] = reply_counts[comment['id']]
|
comment['total_replies'] = reply_counts[comment['id']]
|
||||||
else:
|
else:
|
||||||
comment['total_replies'] = 0
|
comment['total_replies'] = 0
|
||||||
|
comment['hidden_replies'] = comment['total_replies'] - len(replies)
|
||||||
comment['replies'] = self.process_fetched_list(replies, plain)
|
comment['replies'] = self.process_fetched_list(replies, plain)
|
||||||
|
|
||||||
return JSON(rv, 200)
|
return JSON(rv, 200)
|
||||||
|
Loading…
Reference in New Issue
Block a user