mirror of https://gitlab.com/bashrc2/epicyon
Update conversation cache when resolving conversations
parent
f31c254ef9
commit
1c162f7f88
|
@ -129,8 +129,9 @@ def unmute_conversation(base_dir: str, nickname: str, domain: str,
|
||||||
def _get_replies_to_post(post_json_object: {},
|
def _get_replies_to_post(post_json_object: {},
|
||||||
signing_priv_key_pem: str,
|
signing_priv_key_pem: str,
|
||||||
session, as_header, debug: bool,
|
session, as_header, debug: bool,
|
||||||
http_prefix: str, domain: str,
|
http_prefix: str,
|
||||||
depth: int, ids: []) -> []:
|
base_dir: str, nickname: str,
|
||||||
|
domain: str, depth: int, ids: []) -> []:
|
||||||
"""Returns a list of reply posts to the given post as json
|
"""Returns a list of reply posts to the given post as json
|
||||||
"""
|
"""
|
||||||
result = []
|
result = []
|
||||||
|
@ -271,13 +272,17 @@ def _get_replies_to_post(post_json_object: {},
|
||||||
# add it to the list
|
# add it to the list
|
||||||
result.append(item)
|
result.append(item)
|
||||||
|
|
||||||
|
update_conversation(base_dir, nickname, domain,
|
||||||
|
item)
|
||||||
|
|
||||||
if depth < 10 and reply_post_id:
|
if depth < 10 and reply_post_id:
|
||||||
result += \
|
result += \
|
||||||
_get_replies_to_post(item,
|
_get_replies_to_post(item,
|
||||||
signing_priv_key_pem,
|
signing_priv_key_pem,
|
||||||
session, as_header,
|
session, as_header,
|
||||||
debug,
|
debug,
|
||||||
http_prefix, domain,
|
http_prefix, base_dir,
|
||||||
|
nickname, domain,
|
||||||
depth + 1, ids)
|
depth + 1, ids)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -313,6 +318,10 @@ def download_conversation_posts(authorized: bool, session,
|
||||||
if not get_json_valid(post_json_object):
|
if not get_json_valid(post_json_object):
|
||||||
print(post_id + ' returned no json')
|
print(post_id + ' returned no json')
|
||||||
|
|
||||||
|
if post_json_object:
|
||||||
|
update_conversation(base_dir, nickname, domain,
|
||||||
|
post_json_object)
|
||||||
|
|
||||||
# get any replies
|
# get any replies
|
||||||
replies_to_post = []
|
replies_to_post = []
|
||||||
if get_json_valid(post_json_object):
|
if get_json_valid(post_json_object):
|
||||||
|
@ -320,7 +329,8 @@ def download_conversation_posts(authorized: bool, session,
|
||||||
_get_replies_to_post(post_json_object,
|
_get_replies_to_post(post_json_object,
|
||||||
signing_priv_key_pem,
|
signing_priv_key_pem,
|
||||||
session, as_header, debug,
|
session, as_header, debug,
|
||||||
http_prefix, domain, 0, [])
|
http_prefix, base_dir, nickname,
|
||||||
|
domain, 0, [])
|
||||||
|
|
||||||
ids = []
|
ids = []
|
||||||
while get_json_valid(post_json_object):
|
while get_json_valid(post_json_object):
|
||||||
|
@ -386,6 +396,10 @@ def download_conversation_posts(authorized: bool, session,
|
||||||
harmless_markup(post_json_object)
|
harmless_markup(post_json_object)
|
||||||
|
|
||||||
conversation_view = [post_json_object] + conversation_view
|
conversation_view = [post_json_object] + conversation_view
|
||||||
|
|
||||||
|
update_conversation(base_dir, nickname, domain,
|
||||||
|
post_json_object)
|
||||||
|
|
||||||
if not authorized:
|
if not authorized:
|
||||||
# only show a single post to non-authorized viewers
|
# only show a single post to non-authorized viewers
|
||||||
break
|
break
|
||||||
|
@ -406,8 +420,9 @@ def download_conversation_posts(authorized: bool, session,
|
||||||
get_json(signing_priv_key_pem, session, post_id,
|
get_json(signing_priv_key_pem, session, post_id,
|
||||||
as_header, None, debug, __version__,
|
as_header, None, debug, __version__,
|
||||||
http_prefix, domain)
|
http_prefix, domain)
|
||||||
|
|
||||||
if debug:
|
if debug:
|
||||||
if not get_json_valid(post_json_object):
|
if get_json_valid(post_json_object):
|
||||||
print(post_id + ' returned no json')
|
print(post_id + ' returned no json')
|
||||||
|
|
||||||
return conversation_view + replies_to_post
|
return conversation_view + replies_to_post
|
||||||
|
|
Loading…
Reference in New Issue