mirror of https://gitlab.com/bashrc2/epicyon
Function to convert conversation id to thread id
parent
2933af9a05
commit
d393b29b1f
|
@ -411,3 +411,17 @@ def download_conversation_posts(authorized: bool, session,
|
||||||
print(post_id + ' returned no json')
|
print(post_id + ' returned no json')
|
||||||
|
|
||||||
return conversation_view + replies_to_post
|
return conversation_view + replies_to_post
|
||||||
|
|
||||||
|
|
||||||
|
def conversation_tag_to_thread_id(tag: str) -> str:
|
||||||
|
"""Converts a converation tag, such as
|
||||||
|
tag:domain,2024-09-28:objectId=647832678:objectType=Conversation
|
||||||
|
into a thread id such as 20240928647832678
|
||||||
|
"""
|
||||||
|
if not isinstance(tag, str):
|
||||||
|
return ''
|
||||||
|
thread_id = ''
|
||||||
|
for tag_chr in tag:
|
||||||
|
if tag_chr.isdigit():
|
||||||
|
thread_id += tag_chr
|
||||||
|
return thread_id
|
||||||
|
|
10
tests.py
10
tests.py
|
@ -225,6 +225,7 @@ from reading import get_book_link_from_content
|
||||||
from reading import get_book_from_post
|
from reading import get_book_from_post
|
||||||
from reading import get_reading_status
|
from reading import get_reading_status
|
||||||
from reading import store_book_events
|
from reading import store_book_events
|
||||||
|
from conversation import conversation_tag_to_thread_id
|
||||||
|
|
||||||
|
|
||||||
TEST_SERVER_GROUP_RUNNING = False
|
TEST_SERVER_GROUP_RUNNING = False
|
||||||
|
@ -9041,6 +9042,14 @@ def _test_bridgy() -> None:
|
||||||
assert domain == 'brid.gy'
|
assert domain == 'brid.gy'
|
||||||
|
|
||||||
|
|
||||||
|
def _test_conversation_to_thread() -> None:
|
||||||
|
print('conversation to thread')
|
||||||
|
conversation_id = \
|
||||||
|
'tag:domain,2024-09-28:objectId=647832678:objectType=Conversation'
|
||||||
|
thread_id = conversation_tag_to_thread_id(conversation_id)
|
||||||
|
assert thread_id == '20240928647832678'
|
||||||
|
|
||||||
|
|
||||||
def run_all_tests():
|
def run_all_tests():
|
||||||
base_dir = os.getcwd()
|
base_dir = os.getcwd()
|
||||||
data_dir_testing(base_dir)
|
data_dir_testing(base_dir)
|
||||||
|
@ -9059,6 +9068,7 @@ def run_all_tests():
|
||||||
_test_checkbox_names()
|
_test_checkbox_names()
|
||||||
_test_thread_functions()
|
_test_thread_functions()
|
||||||
_test_functions()
|
_test_functions()
|
||||||
|
_test_conversation_to_thread()
|
||||||
_test_bridgy()
|
_test_bridgy()
|
||||||
_test_link_tracking()
|
_test_link_tracking()
|
||||||
_test_remove_tags()
|
_test_remove_tags()
|
||||||
|
|
Loading…
Reference in New Issue