feat: filter out replies to other accounts than original author
This commit is contained in:
parent
67bea0768b
commit
7bb7faa86c
1 changed files with 3 additions and 2 deletions
5
app.py
5
app.py
|
@ -11,14 +11,15 @@ def home():
|
||||||
threads = []
|
threads = []
|
||||||
for id in thread_ids:
|
for id in thread_ids:
|
||||||
status = requests.get(server + '/api/v1/statuses/' + id ).json()
|
status = requests.get(server + '/api/v1/statuses/' + id ).json()
|
||||||
author = status['account']['acct']
|
author = status['account']['id']
|
||||||
context = requests.get(server + '/api/v1/statuses/' + id + '/context').json()
|
context = requests.get(server + '/api/v1/statuses/' + id + '/context').json()
|
||||||
descendants = []
|
descendants = []
|
||||||
for reply in context['descendants']:
|
for reply in context['descendants']:
|
||||||
if reply['account']['acct'] == author:
|
if reply['account']['id'] == author and reply['in_reply_to_account_id'] == author:
|
||||||
descendants.append(clean_status(reply))
|
descendants.append(clean_status(reply))
|
||||||
status = clean_status(status)
|
status = clean_status(status)
|
||||||
status['descendants'] = descendants
|
status['descendants'] = descendants
|
||||||
|
status['descendants_count'] = len(descendants)
|
||||||
threads.append(status)
|
threads.append(status)
|
||||||
return threads
|
return threads
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue