mirror of https://gitlab.com/bashrc2/epicyon
Conversation id is a thread
parent
a58cd1f62f
commit
b4a8628fd5
|
@ -443,3 +443,13 @@ def convthread_id_to_conversation_tag(domain: str,
|
|||
'tag:' + domain + ',' + year + '-' + month + '-' + day + \
|
||||
':objectId=' + post_id + ':objectType=Conversation'
|
||||
return conversation_id
|
||||
|
||||
|
||||
def post_id_to_convthread_id(post_id: str, published: str) -> str:
|
||||
"""Converts a post ID into a conversation thread ID
|
||||
"""
|
||||
if '/statuses/' not in post_id or len(published) < 10:
|
||||
return post_id
|
||||
date_prefix = published[:10].replace('-', '')
|
||||
convthread_id = post_id.replace('/statuses/', '/thread/' + date_prefix)
|
||||
return convthread_id
|
||||
|
|
|
@ -34,6 +34,7 @@ from filters import is_filtered
|
|||
from context import get_individual_post_context
|
||||
from session import get_method
|
||||
from auth import create_basic_auth_header
|
||||
from conversation import post_id_to_convthread_id
|
||||
|
||||
|
||||
def _strings_are_digits(strings_list: []) -> bool:
|
||||
|
@ -1007,7 +1008,7 @@ def _dav_store_event(base_dir: str, nickname: str, domain: str,
|
|||
'cc': [],
|
||||
'object': {
|
||||
'id': post_id,
|
||||
'conversation': post_id,
|
||||
'conversation': post_id_to_convthread_id(post_id, published),
|
||||
'context': post_id,
|
||||
'type': "Note",
|
||||
'summary': None,
|
||||
|
|
9
posts.py
9
posts.py
|
@ -132,6 +132,7 @@ from question import is_question
|
|||
from question import dangerous_question
|
||||
from pyjsonld import JsonLdError
|
||||
from conversation import conversation_tag_to_convthread_id
|
||||
from conversation import post_id_to_convthread_id
|
||||
|
||||
|
||||
def convert_post_content_to_html(message_json: {}) -> None:
|
||||
|
@ -1281,9 +1282,9 @@ def _create_post_s2s(base_dir: str, nickname: str, domain: str, port: int,
|
|||
new_post_attributed_to = \
|
||||
local_actor_url(http_prefix, nickname, domain)
|
||||
if not conversation_id:
|
||||
conversation_id = new_post_id
|
||||
conversation_id = post_id_to_convthread_id(new_post_id, published)
|
||||
if not isinstance(conversation_id, str):
|
||||
conversation_id = new_post_id
|
||||
conversation_id = post_id_to_convthread_id(new_post_id, published)
|
||||
if conversation_id.startswith('tag:'):
|
||||
new_convthread_id = conversation_tag_to_convthread_id(conversation_id)
|
||||
if new_convthread_id:
|
||||
|
@ -1400,9 +1401,9 @@ def _create_post_c2s(base_dir: str, nickname: str, domain: str, port: int,
|
|||
new_post_url = \
|
||||
http_prefix + '://' + domain + '/@' + nickname + '/' + status_number
|
||||
if not conversation_id:
|
||||
conversation_id = new_post_id
|
||||
conversation_id = post_id_to_convthread_id(new_post_id, published)
|
||||
if not isinstance(conversation_id, str):
|
||||
conversation_id = new_post_id
|
||||
conversation_id = post_id_to_convthread_id(new_post_id, published)
|
||||
if conversation_id.startswith('tag:'):
|
||||
new_convthread_id = conversation_tag_to_convthread_id(conversation_id)
|
||||
if new_convthread_id:
|
||||
|
|
3
video.py
3
video.py
|
@ -21,6 +21,7 @@ from utils import get_media_url_from_video
|
|||
from utils import resembles_url
|
||||
from blocking import is_blocked
|
||||
from filters import is_filtered
|
||||
from conversation import post_id_to_convthread_id
|
||||
|
||||
|
||||
def convert_video_to_note(base_dir: str, nickname: str, domain: str,
|
||||
|
@ -95,6 +96,8 @@ def convert_video_to_note(base_dir: str, nickname: str, domain: str,
|
|||
languages_understood, "content")
|
||||
|
||||
conversation_id = remove_id_ending(post_json_object['id'])
|
||||
conversation_id = post_id_to_convthread_id(conversation_id,
|
||||
post_json_object['published'])
|
||||
|
||||
media_type, media_url, media_torrent, media_magnet = \
|
||||
get_media_url_from_video(post_json_object)
|
||||
|
|
Loading…
Reference in New Issue